Unverified Commit b367f722 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil Committed by GitHub
Browse files

Merge pull request #148 from ChrisRackauckas/symbolics3

Update to Symbolics 3
parents 2043139d 7bd1ba0f
......@@ -15,9 +15,9 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
[compat]
DocStringExtensions = "0.8"
IfElse = "0.1"
Symbolics = "0.1.21, 1"
Symbolics = "3"
Unitful = "1"
julia = "1.5"
julia = "1.6"
[extras]
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
......
......@@ -97,7 +97,10 @@ const default_symbolics_constants =
::Type{Num},
x::SBML.Math;
mapping = default_symbolics_mapping,
convert_time = (x::SBML.MathTime) -> Num(Variable(Symbol(x.id))).val,
convert_time = function (x::SBML.MathTime)
sym = Symbol(x.id)
Symbolics.unwrap(first(@variables \$sym))
end,
convert_const = (x::SBML.MathConst) -> Num(default_symbolics_constants[x.id]),
)
......@@ -117,13 +120,19 @@ function Base.convert(
::Type{Num},
x::SBML.Math;
mapping = default_symbolics_mapping,
convert_time = (x::SBML.MathTime) -> Num(Variable(Symbol(x.id))).val,
convert_time = function (x::SBML.MathTime)
sym = Symbol(x.id)
Symbolics.unwrap(first(@variables $sym))
end,
convert_const = (x::SBML.MathConst) -> Num(default_symbolics_constants[x.id]),
)
conv(x::SBML.MathApply) = Num(eval(allowed_sym(x.fn, mapping))(conv.(x.args)...))
conv(x::SBML.MathTime) = convert_time(x)
conv(x::SBML.MathConst) = convert_const(x)
conv(x::SBML.MathIdent) = Num(Variable(Symbol(x.id))).val
function conv(x::SBML.MathIdent)
sym = Symbol(x.id)
Symbolics.unwrap(first(@variables $sym))
end
conv(x::SBML.MathVal) = Num(x.val)
conv(x::SBML.MathLambda) = throw(DomainError(x, "can't translate lambdas to symbolics"))
conv(x)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment