Skip to content

Commit eb6cb6d

Browse files
committed
Minor fixes
1 parent 9247b5c commit eb6cb6d

File tree

5 files changed

+20
-95
lines changed

5 files changed

+20
-95
lines changed

src/ModelingToolkit.jl

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export @derivatives
3737
using Symbolics: _parse_vars, value, makesym, @derivatives, get_variables,
3838
exprs_occur_in
3939
import Symbolics: rename, get_variables!, _solve, hessian_sparsity,
40-
jacobian_sparsity, islinear
40+
jacobian_sparsity, islinear, _iszero, _isone,
41+
tosymbol, lower_varname, diff2term, var_from_nested_derivative
4142

4243
import DiffEqBase: @add_kwonly
4344

@@ -47,6 +48,18 @@ import TreeViews
4748

4849
using Requires
4950

51+
for fun in [:toexpr]
52+
@eval begin
53+
function $fun(eq::Equation; kw...)
54+
Expr(:(=), $fun(eq.lhs; kw...), $fun(eq.rhs; kw...))
55+
end
56+
57+
$fun(eqs::AbstractArray; kw...) = map(eq->$fun(eq; kw...), eqs)
58+
$fun(x::Integer; kw...) = x
59+
$fun(x::AbstractFloat; kw...) = x
60+
end
61+
end
62+
5063
"""
5164
$(TYPEDEF)
5265
@@ -83,7 +96,6 @@ include("variables.jl")
8396
include("parameters.jl")
8497

8598
include("utils.jl")
86-
include("direct.jl")
8799
include("domains.jl")
88100

89101
include("systems/abstractsystem.jl")
@@ -114,7 +126,6 @@ using .SystemStructures
114126

115127
include("systems/reduction.jl")
116128

117-
include("latexify_recipes.jl")
118129
include("build_function.jl")
119130

120131
export ODESystem, ODEFunction, ODEFunctionExpr, ODEProblemExpr

src/direct.jl

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/latexify_recipes.jl

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/systems/abstractsystem.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,3 +427,9 @@ function Base.show(io::IO, sys::AbstractSystem)
427427
end
428428
return nothing
429429
end
430+
431+
@latexrecipe function f(sys::AbstractSystem)
432+
return latexify(equations(sys))
433+
end
434+
435+
Base.show(io::IO, ::MIME"text/latex", x::AbstractSystem) = print(io, latexify(x))

src/systems/diffeqs/odesystem.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ function ODESystem(
104104
ODESystem(deqs, iv′, dvs′, ps′, observed, tgrad, jac, Wfact, Wfact_t, name, systems, default_u0, default_p, nothing)
105105
end
106106

107-
var_from_nested_derivative(x, i=0) = (missing, missing)
108-
var_from_nested_derivative(x::Term,i=0) = operation(x) isa Differential ? var_from_nested_derivative(arguments(x)[1],i+1) : (x,i)
109-
var_from_nested_derivative(x::Sym,i=0) = (x,i)
110-
111107
iv_from_nested_derivative(x::Term) = operation(x) isa Differential ? iv_from_nested_derivative(arguments(x)[1]) : arguments(x)[1]
112108
iv_from_nested_derivative(x::Sym) = x
113109
iv_from_nested_derivative(x) = missing

0 commit comments

Comments
 (0)