Skip to contents

calculate_semiquadratic_form(sys) splits the right-hand side of each equation of a compiled ODE system into A x + x' B_i x + C_i: A holds the coefficients of the linear terms, B[[i]] the upper triangular coefficients of the quadratic terms of equation i, and C the remaining terms. Coefficients may contain parameters. Entries are NULL when the corresponding part is zero.

Usage

calculate_semiquadratic_form(sys, ...)

Arguments

sys

A complete ODE System.

...

Unused.

Value

A list with A (a list matrix), B (a list of list matrices) and C (a list of expressions).

Examples

t <- t_nounits; D <- D_nounits
x <- Variable("x", t); y <- Variable("y", t); k <- Parameter("k")
sys <- mtkcompile(System(list(D(x) ~ -k * x + x * y, D(y) ~ sin(x) - y), t, name = "s"))
calculate_semiquadratic_form(sys)$A
#>      [,1] [,2]
#> [1,] -1   0   
#> [2,] 0    -k