Pre-defined functions & variables
Pre-defined functions
The DiffSL supports the following mathematical functions that can be used in an expression:
pow(x, y)- x raised to the power of ysin(x)- sine of xcos(x)- cosine of xtan(x)- tangent of xexp(x)- exponential of xtanh(x)- hyperbolic tangent of xsinh(x)- hyperbolic sine of xcosh(x)- hyperbolic cosine of xarcsinh(x)- inverse hyperbolic sine of xarccosh(x)- inverse hyperbolic cosine of xlog(x)- natural logarithm of xlog10(x)- base-10 logarithm of xsqrt(x)- square root of xabs(x)- absolute value of xsigmoid(x)- sigmoid function of xheaviside(x)- Heaviside step function of x
You can use these functions as part of an expression in the DSL. For example, to define a variable a that is the sine of another variable b, you can write:
b { 1.0 }
a { sin(b) }
Pre-defined variables
There are two predefined variables in DiffSL. The first is the scalar t which is the current time, this allows the equations to be written as functions of time. For example
F_i { t + sin(t) }
The second is the scalar N which is the current model index, this allows us to write hybrid models with multiple ODE systems in the same file. For example
F_i { g_i[N] * x }