Skip to contents

ConvergenceSimulation(solutions, convergence_axis) collects the errors of solutions computed at the points of a convergence axis (such as the time steps): errors[[k]] holds the mean error k of each solution (with additional_errors, a named list of error series, added), and Oest[[k]] the estimated order of convergence, the absolute mean of \(\log_2(e_{i+1}/e_i)\) over adjacent points. Give expected_value when all error series come from additional_errors.

Usage

ConvergenceSimulation(
  solutions,
  convergence_axis,
  auxdata = NULL,
  additional_errors = NULL,
  expected_value = NULL
)

ConvergenceTrajectory(t, u, u_analytic, errors)

# S3 method for class 'ConvergenceSimulation'
plot(
  x,
  xlab = "Convergence Axis",
  ylab = "Error",
  log = "xy",
  type = "b",
  lwd = 3,
  pch = seq_along(x$errors),
  ...
)

Arguments

solutions

List of solutions with errors.

convergence_axis

Values of the convergence axis.

auxdata

Extra data stored in the result.

additional_errors

Named list of error series.

expected_value

The value of the weak errors, which skips the errors of the solutions.

t, u, u_analytic

Final time, state and analytic state.

errors

Named list of errors.

x

A ConvergenceSimulation.

xlab, ylab, log, type, lwd, pch

Plot settings.

...

Passed to graphics::matplot().

Value

A ConvergenceSimulation (a list with solutions, errors, N, auxdata, Oest and convergence_axis), or a ConvergenceTrajectory.

Details

ConvergenceTrajectory(t, u, u_analytic, errors) is the part of an SDE trajectory a convergence test keeps (its final time, final state, final analytic state and errors) when the solutions are not retained.

length(sim) is the number of solutions and sim[[i]] the ith one; plot(sim) draws the errors against the convergence axis on log scales.

Examples

sols <- list(list(errors = list(final = 0.1)), list(errors = list(final = 0.025)))
sim <- ConvergenceSimulation(sols, c(0.1, 0.05))
sim$Oest$final
#> [1] 2