build_solution(prob, alg, t, u, ...) builds the solution of a problem:
an ODESolution for time dependent problems, a nonlinear solution
otherwise (retcode, resid, stats). build_linear_solution(alg, u, resid) and build_eigenvalue_solution(alg, values, vectors) build linear
and eigenvalue solutions. sensitivity_solution(sol, u, t) replaces the
saved values. strip_interpolation(sol) drops the dense output,
solution_new_retcode(sol, retcode) changes the return code and
wrap_sol(sol) returns sol. calculate_solution_errors(sol) compares a
solution with the analytic solution of its problem (analytic = function(u0, p, t) of ODEFunction()): the final error final, the
errors at the saved times l2 and l_inf, and with dense_errors the
errors on 100 interpolated points; has_analytic(f) says whether a
function has one.
Usage
build_solution(
prob,
alg,
t = NULL,
u,
retcode = "Success",
resid = NULL,
stats = list(),
...
)
build_linear_solution(
alg,
u,
resid = NULL,
retcode = "Success",
stats = list()
)
build_eigenvalue_solution(alg, values, vectors = NULL, retcode = "Success")
sensitivity_solution(sol, u, t = NULL)
strip_interpolation(sol)
solution_new_retcode(sol, retcode)
wrap_sol(sol)
has_analytic(f)
calculate_solution_errors(sol, timeseries_errors = TRUE, dense_errors = FALSE)Examples
f <- ODEFunction(function(u, p, t) -u, analytic = function(u0, p, t) u0 * exp(-t))
sol <- solve(ODEProblem(f, 1, c(0, 1)), Tsit5())
calculate_solution_errors(sol)$errors$final
#> [1] 1.522561e-07