NSDERungeKutta.jl

This is the documentation of NSDERungeKutta.jl, a Julia package implementing Runge-Kutta methods.

API

All exported types and functions are considered part of the public API, and thus documented in this manual.

NSDERungeKutta.AdaptiveParametersType
AdaptiveParameters <: AbstractAdaptiveParameters

A composite type for the parameters of an adaptive AbstractRungeKuttaSolver.

Constructors

AdaptiveParameters(εₐ::Real=0.0, εᵣ::Real=1e-5, Mₙ::Integer=100)

Arguments

  • εₐ :: Real : absolute tolerance
  • εᵣ :: Real : relative tolerance
  • Mₙ :: Integer : maximum number of iterations
source
NSDERungeKutta.ButcherTableauType
ButcherTableau <: AbstractButcherTableau

A composite type for the Butcher tableau of a Runge-Kutta solver:

\[\begin{array}{c|c} c & A \\ \hline p & b^\intercal \\ q & d^\intercal \end{array}\]

Constructors

ButcherTableau(A, b, c, s, p[, d, q])
ButcherTableau(tableau::AbstractMatrix{<:Real})

Arguments

  • A :: AbstractMatrix{<:Real} : matrix of coefficients
  • b :: AbstractVector{<:Real} : vector of weights
  • c :: AbstractVector{<:Real} : vector of nodes
  • s :: Integer : number of stages
  • p :: Integer : order of accuracy
  • d :: AbstractVector{<:Real} : embedding's vector of weights (can be nothing)
  • q :: Integer : embedding's order of accuracy (can be nothing)

Functions

butchertableau : return matrix of parameters.

source
NSDERungeKutta.DiagonallyImplicitRungeKuttaSolverType
DiagonallyImplicitRungeKuttaSolver <: AbstractRungeKuttaSolver

A composite type for diagonally-implicit solvers.

Constructors

DiagonallyImplicitRungeKuttaSolver(tableau, stepsize, newton[, adaptive])
DIRK(args...; kwargs...)

Arguments

  • tableau :: AbstractButcherTableau
  • stepsize :: AbstractStepSize
  • newton :: AbstractNewtonParameters
  • adaptive :: AbstractAdaptiveParameters

Methods

(solver::DiagonallyImplicitRungeKuttaSolver)(solution::AbstractRungeKuttaSolution, problem::AbstractInitialValueProblem) :: RungeKuttaSolution
(solver::DiagonallyImplicitRungeKuttaSolver)(problem::AbstractInitialValueProblem) :: RungeKuttaSolution

returns the solution of a problem using solver.

source
NSDERungeKutta.ExplicitExponentialRungeKuttaSolverType
ExplicitExponentialRungeKuttaSolver <: AbstractRungeKuttaSolver

A composite type for an exponential explicit AbstractRungeKuttaSolver.

Constructors

ExplicitExponentialRungeKuttaSolver(tableau, stepsize[, adaptive])
ExRK(args...; kwargs...)

Arguments

  • tableau :: AbstractButcherTableau
  • stepsize :: AbstractStepSize
  • adaptive :: AbstractAdaptiveParameters

Methods

(solver::ExplicitExponentialRungeKuttaSolver)(solution::AbstractRungeKuttaSolution, problem::AbstractInitialValueProblem) :: RungeKuttaSolution
(solver::ExplicitExponentialRungeKuttaSolver)(problem::AbstractInitialValueProblem) :: RungeKuttaSolution

returns the solution of a problem using solver.

source
NSDERungeKutta.ExplicitRungeKuttaSolverType
ExplicitRungeKuttaSolver <: AbstractRungeKuttaSolver

A composite type for explicit solvers.

Constructors

ExplicitRungeKuttaSolver(tableau, stepsize[, adaptive])
ERK(args...; kwargs...)

Arguments

  • tableau :: AbstractButcherTableau
  • stepsize :: AbstractStepSize
  • adaptive :: AbstractAdaptiveParameters

Methods

(solver::ExplicitRungeKuttaSolver)(solution::AbstractRungeKuttaSolution, problem::AbstractInitialValueProblem) :: RungeKuttaSolution
(solver::ExplicitRungeKuttaSolver)(problem::AbstractInitialValueProblem) :: RungeKuttaSolution

returns the solution of a problem using solver.

source
NSDERungeKutta.ImplicitExplicitRungeKuttaSolverType
ImplicitExplicitRungeKuttaSolver <: AbstractRungeKuttaSolver

A composite type for implicit-explicit solvers.

Constructors

ImplicitExplicitRungeKuttaSolver(implicitableau, explicitableau, stepsize, newton[, adaptive])
IERK(args...; kwargs...)

Arguments

  • implicitableau :: AbstractButcherTableau
  • explicitableau :: AbstractButcherTableau
  • stepsize :: AbstractStepSize
  • newton :: AbstractNewtonParameters
  • adaptive :: AbstractAdaptiveParameters

Methods

(solver::ImplicitExplicitRungeKuttaSolver)(solution::AbstractRungeKuttaSolution, problem::AbstractInitialValueProblem) :: RungeKuttaSolution
(solver::ImplicitExplicitRungeKuttaSolver)(problem::AbstractInitialValueProblem) :: RungeKuttaSolution

returns the solution of a problem using solver.

source
NSDERungeKutta.ImplicitRungeKuttaSolverType
ImplicitRungeKuttaSolver <: AbstractRungeKuttaSolver

A composite type for implicit solvers.

Constructors

ImplicitRungeKuttaSolver(tableau, stepsize, newton[, adaptive])
IRK(args...; kwargs...)

Arguments

  • tableau :: AbstractButcherTableau
  • stepsize :: AbstractStepSize
  • newton :: AbstractNewtonParameters
  • adaptive :: AbstractAdaptiveParameters

Methods

(solver::ImplicitRungeKuttaSolver)(solution::AbstractRungeKuttaSolution, problem::AbstractInitialValueProblem) :: RungeKuttaSolution
(solver::ImplicitRungeKuttaSolver)(problem::AbstractInitialValueProblem) :: RungeKuttaSolution

returns the solution of a problem using solver.

source
NSDERungeKutta.NewtonParametersType
NewtonParameters <: AbstractNewtonParameters

A composite type for the parameters of simplified Newton.

Constructors

NewtonParameters(; εᵣ=1e-3, Mₙ=10)

Arguments

  • εᵣ :: Real : relative tolerance
  • Mₙ :: Integer : maximum number of iterations
source
NSDERungeKutta.RungeKuttaSolutionType
RungeKuttaSolution <: AbstractRungeKuttaSolution

A composite type for an AbstractRungeKuttaSolution obtained using an AbstractRungeKuttaSolver.

Constructors

RungeKuttaSolution(u, t)
RungeKuttaSolution(problem, solver)

Arguments

  • u :: AbstractVector{<:AbstractVector{<:Number}} : numerical solution
  • t :: AbstractVector{<:Real} : time grid

Functions

source
NSDERungeKutta.StepSizeType
StepSize <: AbstractStepSize

A composite type for the step-size a Runge-Kutta solver.

Constructors

StepSize(h::Real)

Functions

stepsize : returns (last) step-size

source
Base.firstindexMethod
firstindex(solution::RungeKuttaSolution)

returns the first index of solution.

source
Base.getindexMethod
getindex(solution::RungeKuttaSolution, v::AbstractVector) :: RungeKuttaSolution

returns a new RungeKuttaSolution containing the fields of solution at the indices v.

source
Base.lastindexMethod
lastindex(solution::RungeKuttaSolution)

returns the last index of solution.

source
Base.lengthMethod
length(solution::RungeKuttaSolution)

returns the number of time steps in solution.

source
Base.setindex!Method
setindex!(solution::RungeKuttaSolution, values::RungeKuttaSolution, v::AbstractVector)

stores the fields of values into the fields of solution at the specified indices v.

source
Base.setindex!Method
setindex!(solution::RungeKuttaSolution, values::RungeKuttaSolution, i::Integer)

stores the fields of values into the fields of solution at the specified index i.

source
Base.setindex!Method
setindex!(solution::RungeKuttaSolution, values::Tuple, i::Integer)

stores the values from values into the fields of solution at the specified index i.

source
Base.sizeMethod
size(solution::RungeKuttaSolution)

returns a tuple containing the number of variables and time steps in solution.

source
NSDEBase.solveMethod
solve(problem::AbstractInitialValueProblem, solver::AbstractRungeKuttaSolver) :: RungeKuttaSolution

computes the solution of problem using solver.

source
NSDERungeKutta.DIRKMethod
DiagonallyImplicitRungeKuttaSolver <: AbstractRungeKuttaSolver

A composite type for diagonally-implicit solvers.

Constructors

DiagonallyImplicitRungeKuttaSolver(tableau, stepsize, newton[, adaptive])
DIRK(args...; kwargs...)

Arguments

  • tableau :: AbstractButcherTableau
  • stepsize :: AbstractStepSize
  • newton :: AbstractNewtonParameters
  • adaptive :: AbstractAdaptiveParameters

Methods

(solver::DiagonallyImplicitRungeKuttaSolver)(solution::AbstractRungeKuttaSolution, problem::AbstractInitialValueProblem) :: RungeKuttaSolution
(solver::DiagonallyImplicitRungeKuttaSolver)(problem::AbstractInitialValueProblem) :: RungeKuttaSolution

returns the solution of a problem using solver.

source
NSDERungeKutta.DP54Method
DormandPrince54(; h::Real=0.0, εₐ::Real=0.0, εᵣ::Real=1e-5, Mₙ::Integer=100, save_stepsizes::Bool=false) :: ExplicitRungeKuttaSolver
DP54(args...; kwargs...) :: ExplicitRungeKuttaSolver

returns an ExplicitRungeKuttaSolver for the 5th-order Dormand-Prince method with 4th-order error estimate.

source
NSDERungeKutta.DormandPrince54Method
DormandPrince54(; h::Real=0.0, εₐ::Real=0.0, εᵣ::Real=1e-5, Mₙ::Integer=100, save_stepsizes::Bool=false) :: ExplicitRungeKuttaSolver
DP54(args...; kwargs...) :: ExplicitRungeKuttaSolver

returns an ExplicitRungeKuttaSolver for the 5th-order Dormand-Prince method with 4th-order error estimate.

source
NSDERungeKutta.ERKMethod
ExplicitRungeKuttaSolver <: AbstractRungeKuttaSolver

A composite type for explicit solvers.

Constructors

ExplicitRungeKuttaSolver(tableau, stepsize[, adaptive])
ERK(args...; kwargs...)

Arguments

  • tableau :: AbstractButcherTableau
  • stepsize :: AbstractStepSize
  • adaptive :: AbstractAdaptiveParameters

Methods

(solver::ExplicitRungeKuttaSolver)(solution::AbstractRungeKuttaSolution, problem::AbstractInitialValueProblem) :: RungeKuttaSolution
(solver::ExplicitRungeKuttaSolver)(problem::AbstractInitialValueProblem) :: RungeKuttaSolution

returns the solution of a problem using solver.

source
NSDERungeKutta.ExRKMethod
ExplicitExponentialRungeKuttaSolver <: AbstractRungeKuttaSolver

A composite type for an exponential explicit AbstractRungeKuttaSolver.

Constructors

ExplicitExponentialRungeKuttaSolver(tableau, stepsize[, adaptive])
ExRK(args...; kwargs...)

Arguments

  • tableau :: AbstractButcherTableau
  • stepsize :: AbstractStepSize
  • adaptive :: AbstractAdaptiveParameters

Methods

(solver::ExplicitExponentialRungeKuttaSolver)(solution::AbstractRungeKuttaSolution, problem::AbstractInitialValueProblem) :: RungeKuttaSolution
(solver::ExplicitExponentialRungeKuttaSolver)(problem::AbstractInitialValueProblem) :: RungeKuttaSolution

returns the solution of a problem using solver.

source
NSDERungeKutta.F45Method
Fehlberg45(; h::Real=0.0, εₐ::Real=0.0, εᵣ::Real=1e-5, Mₙ::Integer=100, save_stepsizes::Bool=false) :: ExplicitRungeKuttaSolver
F45(args...; kwargs...) :: ExplicitRungeKuttaSolver

returns an ExplicitRungeKuttaSolver for the 4th-order Fehlberg method with 5th-order error estimate.

source
NSDERungeKutta.F78Method
Fehlberg78(; h::Real=0.0, εₐ::Real=0.0, εᵣ::Real=1e-5, Mₙ::Integer=100, save_stepsizes::Bool=false) :: ExplicitRungeKuttaSolver
F78(args...; kwargs...) :: ExplicitRungeKuttaSolver

returns an ExplicitRungeKuttaSolver for the 7th-order Fehlberg method with 8th-order error estimate.

source
NSDERungeKutta.Fehlberg45Method
Fehlberg45(; h::Real=0.0, εₐ::Real=0.0, εᵣ::Real=1e-5, Mₙ::Integer=100, save_stepsizes::Bool=false) :: ExplicitRungeKuttaSolver
F45(args...; kwargs...) :: ExplicitRungeKuttaSolver

returns an ExplicitRungeKuttaSolver for the 4th-order Fehlberg method with 5th-order error estimate.

source
NSDERungeKutta.Fehlberg78Method
Fehlberg78(; h::Real=0.0, εₐ::Real=0.0, εᵣ::Real=1e-5, Mₙ::Integer=100, save_stepsizes::Bool=false) :: ExplicitRungeKuttaSolver
F78(args...; kwargs...) :: ExplicitRungeKuttaSolver

returns an ExplicitRungeKuttaSolver for the 7th-order Fehlberg method with 8th-order error estimate.

source
NSDERungeKutta.HeunEulerMethod
HeunEuler(; h::Real=0.0, εₐ::Real=0.0, εᵣ::Real=1e-5, Mₙ::Integer=100, save_stepsizes::Bool=false) :: ExplicitRungeKuttaSolver

returns an ExplicitRungeKuttaSolver for the 2nd-order Heun-Euler method with 1st-order error estimate.

source
NSDERungeKutta.IERKMethod
ExplicitRungeKuttaSolver <: AbstractRungeKuttaSolver

A composite type for explicit solvers.

Constructors

ExplicitRungeKuttaSolver(tableau, stepsize[, adaptive])
ERK(args...; kwargs...)

Arguments

  • tableau :: AbstractButcherTableau
  • stepsize :: AbstractStepSize
  • adaptive :: AbstractAdaptiveParameters

Methods

(solver::ExplicitRungeKuttaSolver)(solution::AbstractRungeKuttaSolution, problem::AbstractInitialValueProblem) :: RungeKuttaSolution
(solver::ExplicitRungeKuttaSolver)(problem::AbstractInitialValueProblem) :: RungeKuttaSolution

returns the solution of a problem using solver.

source
NSDERungeKutta.IRKMethod
ImplicitRungeKuttaSolver <: AbstractRungeKuttaSolver

A composite type for implicit solvers.

Constructors

ImplicitRungeKuttaSolver(tableau, stepsize, newton[, adaptive])
IRK(args...; kwargs...)

Arguments

  • tableau :: AbstractButcherTableau
  • stepsize :: AbstractStepSize
  • newton :: AbstractNewtonParameters
  • adaptive :: AbstractAdaptiveParameters

Methods

(solver::ImplicitRungeKuttaSolver)(solution::AbstractRungeKuttaSolution, problem::AbstractInitialValueProblem) :: RungeKuttaSolution
(solver::ImplicitRungeKuttaSolver)(problem::AbstractInitialValueProblem) :: RungeKuttaSolution

returns the solution of a problem using solver.

source
NSDERungeKutta.V65Method
Verner65(; h::Real=0.0, εₐ::Real=0.0, εᵣ::Real=1e-5, Mₙ::Integer=100, save_stepsizes::Bool=false) :: ExplicitRungeKuttaSolver
V65(args...; kwargs...) :: ExplicitRungeKuttaSolver

returns an ExplicitRungeKuttaSolver for the 6th-order Verner method with 5th-order error estimate.

source
NSDERungeKutta.Verner65Method
Verner65(; h::Real=0.0, εₐ::Real=0.0, εᵣ::Real=1e-5, Mₙ::Integer=100, save_stepsizes::Bool=false) :: ExplicitRungeKuttaSolver
V65(args...; kwargs...) :: ExplicitRungeKuttaSolver

returns an ExplicitRungeKuttaSolver for the 6th-order Verner method with 5th-order error estimate.

source
NSDERungeKutta.extractMethod
extract(solution::RungeKuttaSolution, v::AbstractVector) :: RungeKuttaSolution

returns the variables of solution indicated by the indices v.

source
NSDERungeKutta.extractMethod
extract(solution::RungeKuttaSolution, i::Integer) :: RungeKuttaSolution

returns the i-th variable of solution. i = 0 returns t.

source
NSDERungeKutta.extractMethod
extract(solution::RungeKuttaSolution) :: RungeKuttaSolution

returns all variables of solution, including t.

source
NSDERungeKutta.solve!Method
solve!(solution::AbstractRungeKuttaSolution, problem::AbstractInitialValueProblem, solver::AbstractRungeKuttaSolver) :: RungeKuttaSolution

computes the solution of problem using solver.

source
NSDERungeKutta.ℛMethod
ℛ(Z::AbstractMatrix, tableau::AbstractButcherTableau) :: AbstractMatrix
ℛ(Z::AbstractMatrix, solver::AbstractRungeKuttaSolver) :: AbstractMatrix

returns the stability function of solver.

source
NSDERungeKutta.ℛMethod
ℛ(z::Number, tableau::AbstractButcherTableau) :: Number
ℛ(z::Number, solver::AbstractRungeKuttaSolver) :: Number

returns the stability function of solver:

\[ R(z) = \frac{\det(I - z(A - \mathbb{1}b^\intercal))}{\det(I - zA)}.\]

source