Commit 951bf82b authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

make the symbolics translation a bit more comprehensive

parent 6c2df2d6
...@@ -11,21 +11,10 @@ unambiguously represented in Julia; it is supposed to be extended by the user ...@@ -11,21 +11,10 @@ unambiguously represented in Julia; it is supposed to be extended by the user
if more functions need to be supported. if more functions need to be supported.
""" """
const default_symbolics_mapping = Dict{String,Any}( const default_symbolics_mapping = Dict{String,Any}(
"*" => :*,
"+" => :+, "+" => :+,
"-" => :-, "-" => :-,
"*" => :*,
"/" => :/, "/" => :/,
"power" => :^,
"lt" => :<,
"leq" => :<=,
"geq" => :>=,
"gt" => :>,
"ceiling" => :ceil,
"floor" => :floor,
"piecewise" => :(Core.ifelse),
"ln" => :log,
"exp" => :exp,
"abs" => :abs, "abs" => :abs,
"arccos" => :acos, "arccos" => :acos,
"arccosh" => :acosh, "arccosh" => :acosh,
...@@ -39,6 +28,7 @@ const default_symbolics_mapping = Dict{String,Any}( ...@@ -39,6 +28,7 @@ const default_symbolics_mapping = Dict{String,Any}(
"arcsinh" => :asinh, "arcsinh" => :asinh,
"arctan" => :atan, "arctan" => :atan,
"arctanh" => :atanh, "arctanh" => :atanh,
"ceiling" => :ceil,
"cos" => :cos, "cos" => :cos,
"cosh" => :cosh, "cosh" => :cosh,
"cot" => :cot, "cot" => :cot,
...@@ -46,17 +36,32 @@ const default_symbolics_mapping = Dict{String,Any}( ...@@ -46,17 +36,32 @@ const default_symbolics_mapping = Dict{String,Any}(
"csc" => :csc, "csc" => :csc,
"csch" => :csch, "csch" => :csch,
"eq" => :isequal, "eq" => :isequal,
"exp" => :exp,
"factorial" => :factorial, "factorial" => :factorial,
# "log" => :log, # fix "floor" => :floor,
# "root" => , "geq" => :>=,
"sec" => :sec, "gt" => :>,
"leq" => :<=,
"ln" => :log,
"log" => :sbmlLog,
"lt" => :<,
"piecewise" => :(Core.ifelse),
"power" => :^,
"root" => :sbmlRoot,
"sech" => :sech, "sech" => :sech,
"sin" => :sin, "sec" => :sec,
"sinh" => :sinh, "sinh" => :sinh,
"tan" => :tan, "sin" => :sin,
"tanh" => :tanh, "tanh" => :tanh,
"tan" => :tan,
) )
sbmlLog(x) = log(x, 10)
sbmlLog(base, x) = log(x, base)
sbmlRoot(x) = sqrt(x)
sbmlRoot(power, x) = x^(1 / power)
allowed_sym(x, allowed_funs) = allowed_sym(x, allowed_funs) =
haskey(allowed_funs, x) ? allowed_funs[x] : haskey(allowed_funs, x) ? allowed_funs[x] :
throw(DomainError(x, "Unknown SBML function")) throw(DomainError(x, "Unknown SBML function"))
......
Supports Markdown
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