Skip to contents

generate_W(sys) returns an R function (u, p, gamma, t) computing gamma * M + J, with M the mass matrix and J the Jacobian of the right-hand side, the matrix the implicit solvers factorize (as ModelingToolkit's generate_W).

Usage

generate_W(sys, ...)

Arguments

sys

A complete ODE System.

...

Unused.

Value

An R function.

Examples

t <- t_nounits; D <- D_nounits
x <- Variable("x", t); k <- Parameter("k")
sys <- mtkcompile(System(list(D(x) ~ -k * x^2), t, name = "s"))
W <- generate_W(sys)
W(2, c(k = 3), -1, 0)
#>      [,1]
#> [1,]  -13