Skip to content

Commit 28a6ed2

Browse files
feat: throw error when differentiating registered function with no derivative in structural_simplify
1 parent 349e9d5 commit 28a6ed2

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/structural_transformation/StructuralTransformations.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ using Setfield: @set!, @set
44
using UnPack: @unpack
55

66
using Symbolics: unwrap, linear_expansion, fast_substitute
7+
import Symbolics
78
using SymbolicUtils
89
using SymbolicUtils.Code
910
using SymbolicUtils.Rewriters

src/structural_transformation/symbolics_tearing.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function eq_derivative!(ts::TearingState{ODESystem}, ieq::Int; kwargs...)
6565

6666
sys = ts.sys
6767
eq = equations(ts)[ieq]
68-
eq = 0 ~ ModelingToolkit.derivative(eq.rhs - eq.lhs, get_iv(sys))
68+
eq = 0 ~ Symbolics.derivative(eq.rhs - eq.lhs, get_iv(sys); throw_no_derivative = true)
6969
push!(equations(ts), eq)
7070
# Analyze the new equation and update the graph/solvable_graph
7171
# First, copy the previous incidence and add the derivative terms.

0 commit comments

Comments
 (0)