# BSeries.jl API

`BSeries.ExactSolution`

— Type`ExactSolution{T}()`

Lazy representation of the B-series of the exact solution of an ordinary differential equation using coefficients of type at least as representative as `T`

.

`BSeries.bseries`

— Method`bseries(A::AbstractMatrix, b::AbstractVector, c::AbstractVector, order)`

Compute the B-series of the Runge-Kutta method with Butcher coefficients `A, b, c`

up to a prescribed `order`

`BSeries.compose`

— Method`compose(b, a, t::RootedTree)`

Compute the coefficient correspoding to the tree `t`

of the B-series that is formed by composing the B-series `a`

with the B-series `b`

.

**References**

Section 3.1 of

- Philippe Chartier, Ernst Hairer, Gilles Vilmart (2010) Algebraic Structures of B-series. Foundations of Computational Mathematics DOI: 10.1007/s10208-010-9065-1

`BSeries.compute_derivative`

— Function`compute_derivative(expression, variable)`

Internal function specialized on symbolic variables and expressions from

if these packages are loaded (via Requires.jl).

`BSeries.elementary_differentials`

— Method`elementary_differentials(f, u, order)`

Compute all elementary differentials of the vector field `f`

with independent variables `u`

up to the given `order`

. The return value can be indexed by rooted trees to obtain the corresponding elementary differential.

`BSeries.modified_equation`

— Method`modified_equation(A::AbstractMatrix, b::AbstractVector, c::AbstractVector, order)`

Compute the B-series of the modified equation of the Runge-Kutta method with Butcher coefficients `A, b, c`

up to the prescribed `order`

.

Given an ordinary differential equation (ODE) $u'(t) = f(u(t))$ and a Runge-Kutta method, the idea is to interpret the numerical solution with given time step size as exact solution of a modified ODE $u'(t) = fₕ(u(t))$.

The coefficients of the B-series returned by this method need to be multiplied by the corresponding elementary differential of the input vector field $f$.

**References**

Section 3.2 of

- Philippe Chartier, Ernst Hairer, Gilles Vilmart (2010) Algebraic Structures of B-series. Foundations of Computational Mathematics DOI: 10.1007/s10208-010-9065-1

`BSeries.modified_equation`

— Method```
modified_equation(f, u, dt,
A::AbstractMatrix, b::AbstractVector, c::AbstractVector, order)
```

Compute the B-series of the modified equation of the Runge-Kutta method with Butcher coefficients `A, b, c`

up to the prescribed `order`

with respect to the ordinary differential equation $u'(t) = f(u(t))$ with vector field `f`

and dependent variables `u`

for a time step size `dt`

.

Here, `u`

is assumed to be a vector of symbolic variables and `f`

is assumed to be a vector of expressions in these variables. Currently, symbolic variables from

are supported.

**References**

Section 3.2 of

- Philippe Chartier, Ernst Hairer, Gilles Vilmart (2010) Algebraic Structures of B-series. Foundations of Computational Mathematics DOI: 10.1007/s10208-010-9065-1

`BSeries.modifying_integrator`

— Method`modifying_integrator(A::AbstractMatrix, b::AbstractVector, c::AbstractVector, order)`

Compute the B-series of a "modifying integrator" equation of the Runge-Kutta method with Butcher coefficients `A, b, c`

up to the prescribed `order`

.

Given an ordinary differential equation (ODE) $u'(t) = f(u(t))$ and a Runge-Kutta method, the idea is to find a modified ODE $u'(t) = fₕ(u(t))$ such that the numerical solution with given time step size is the exact solution of the original ODE.

The coefficients of the B-series returned by this method need to be multiplied by the corresponding elementary differential of the input vector field $f$.

**References**

Section 3.2 of

`BSeries.modifying_integrator`

— Method```
modifying_integrator(f, u, dt,
A::AbstractMatrix, b::AbstractVector, c::AbstractVector, order)
```

Compute the B-series of a "modifying integrator" equation of the Runge-Kutta method with Butcher coefficients `A, b, c`

up to the prescribed `order`

with respect to the ordinary differential equation $u'(t) = f(u(t))$ with vector field `f`

and dependent variables `u`

for a time step size `dt`

.

Here, `u`

is assumed to be a vector of symbolic variables and `f`

is assumed to be a vector of expressions in these variables. Currently, symbolic variables from

are supported.

**References**

Section 3.2 of

`BSeries.substitute`

— Method`substitute(b, a, t::RootedTree)`

Compute the coefficient correspoding to the tree `t`

of the B-series that is formed by substituting the B-series `b`

into the B-series `a`

.

**References**

Section 3.2 of