Skip to contents

generate_trajectory(sys, expr) returns an R function f(p, t) of the parameter vector of a problem built from sys and the independent variable, evaluating expr (parameter bindings and observed variables that reduce to parameters are inlined). It compiles the initial_trajectory guesses of DynamicOptProblem().

Usage

generate_trajectory(sys, expr, ...)

Arguments

sys

A complete time dependent System.

expr

An expression of the independent variable and parameters.

...

Unused.

Value

A function of p and t.

Examples

t <- t_nounits; D <- D_nounits
x <- Variable("x", t); a <- Parameter("a")
sys <- mtkcompile(System(list(D(x) ~ -a * x), t, name = "s"))
f <- generate_trajectory(sys, a * t^2)
f(2, 3)
#> [1] 18