Skip to contents

AnalyticalProblem(f, u0, tspan, p) is a problem whose solution is known: f(u0, p, t) is the state at t. solve(prob, dt = , saveat = ) evaluates it on the requested times (every dt, saveat, or the two ends of tspan) and returns an ODESolution() interpolated linearly.

Usage

AnalyticalProblem(f, u0, tspan, p = numeric(), ...)

Arguments

f

Solution f(u0, p, t).

u0, tspan, p

Initial state, time span and parameters.

...

Options passed to solve().

Value

A problem.

Examples

prob <- AnalyticalProblem(function(u0, p, t) u0 * exp(-t), 1, c(0, 1))
solve(prob, dt = 0.5)$u
#> [[1]]
#> [1] 1
#> 
#> [[2]]
#> [1] 0.6065307
#> 
#> [[3]]
#> [1] 0.3678794
#>