File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change 1
1
import SymbolicUtils: symtype, term, hasmetadata, issym
2
2
struct MTKConstantCtx end
3
3
4
+ isconstant (x:: Num ) = isconstant (unwrap (x))
4
5
function isconstant (x)
5
6
x = unwrap (x)
6
7
x isa Symbolic && getmetadata (x, MTKConstantCtx, false )
7
8
end
8
- isconstant (x :: Num ) = isconstant ( unwrap (x))
9
+
9
10
"""
10
11
toconst(s::Sym)
11
12
12
13
Maps the parameter to a constant. The parameter must have a default.
13
14
"""
14
- function toconstant (s)
15
- if s isa Symbolics. Arr
16
- Symbolics. wrap (toconstant (Symbolics. unwrap (s)))
17
- elseif s isa AbstractArray
18
- map (toconstant, s)
19
- else
20
- hasmetadata (s, Symbolics. VariableDefaultValue) ||
21
- throw (ArgumentError (" Constant `$(s) ` must be assigned a default value." ))
22
- setmetadata (s, MTKConstantCtx, true )
23
- end
15
+ function toconstant (s:: Sym )
16
+ hasmetadata (s, Symbolics. VariableDefaultValue) ||
17
+ throw (ArgumentError (" Constant `$(s) ` must be assigned a default value." ))
18
+ setmetadata (s, MTKConstantCtx, true )
24
19
end
20
+
25
21
toconstant (s:: Num ) = wrap (toconstant (value (s)))
26
22
27
23
"""
Original file line number Diff line number Diff line change 197
197
198
198
function ODESystem (eqs, iv = nothing ; kwargs... )
199
199
eqs = scalarize (eqs)
200
- # NOTE: this assumes that the order of algebric equations doesn't matter
200
+ # NOTE: this assumes that the order of algebraic equations doesn't matter
201
201
diffvars = OrderedSet ()
202
202
allstates = OrderedSet ()
203
203
ps = OrderedSet ()
You can’t perform that action at this time.
0 commit comments