Exponential Integrators
This module provides exponential integrators for ODEs.
Exponential integrators are a large class of methods from numerical analysis is based on the exact integration of the linear part of the initial value problem. Because the linear part is integrated exactly, this can help to mitigate the stiffness of a differential equation.
We consider initial value problems of the form,
which can be decomposed of
where \(L={\frac {\partial f}{\partial u}}\) (the Jacobian of f) is composed of linear terms, and \(N=f(u)Lu\) is composed of the nonlinear terms.
This procedure enjoys the advantage, in each step, that \({\frac {\partial N_{n}}{\partial u}}(u_{n})=0\). This considerably simplifies the derivation of the order conditions and improves the stability when integrating the nonlinearity \(N(u(t))\).
Exact integration of this problem from time 0 to a later time \(t\) can be performed using matrix exponentials to define an integral equation for the exact solution:
This representation of the exact solution is also called as variationofconstant formula. In the case of \(N\equiv 0\), this formulation is the exact solution to the linear differential equation.
Exponential Rosenbrock methods
Exponential Rosenbrock methods were shown to be very efficient in solving large systems of stiff ODEs. Applying the variationofconstants formula gives the exact solution at time \(t_{n+1}\) with the numerical solution \(u_n\) as
where \(h_n=t_{n+1}t_n\).
The idea now is to approximate the integral in (1) by some quadrature rule with nodes \(c_{i}\) and weights \(b_{i}(h_{n}L)\) (\(1\leq i\leq s\)). This yields the following class of sstage explicit exponential Rosenbrock methods:
where \(U_{ni}\approx u(t_{n}+c_{i}h_{n})\).
The coefficients \(a_{ij}(z),b_{i}(z)\) are usually chosen as linear combinations of the entire functions \(\varphi _{k}(c_{i}z),\varphi _{k}(z)\), respectively, where
By introducing the difference \(D_{ni}=N(U_{ni})N(u_{n})\), they can be reformulated in a more efficient way for implementation as
where \(\varphi_{1}(z)=\frac{e^z1}{z}\).
In order to implement this scheme with adaptive step size, one can consider, for the purpose of local error estimation, the following embedded methods
which use the same stages \(U_{ni}\) but with weights \({\bar {b}}_{i}\).
For convenience, the coefficients of the explicit exponential Rosenbrock methods together with their embedded methods can be represented by using the socalled reduced Butcher tableau as follows:
 1
 2
Hochbruck, M., & Ostermann, A. (2010). Exponential integrators. Acta Numerica, 19, 209286.

The exponential Euler method for ODEs. 
 class brainpy.integrators.ode.exponential.ExponentialEuler(f, var_type=None, dt=None, name=None, show_code=False)[source]
The exponential Euler method for ODEs.
The simplest exponential Rosenbrock method is the exponential Rosenbrock–Euler scheme, which has order 2.
For an ODE equation of the form
\[u^{\prime}=f(u), \quad u(0)=u_{0}\]its schema is given by
\[u_{n+1}= u_{n}+h \varphi(hL) f (u_{n})\]where \(L=f^{\prime}(u_{n})\) and \(\varphi(z)=\frac{e^{z}1}{z}\).
For a linear ODE system: \(u^{\prime} = Ay + B\), the above equation is equal to \(u_{n+1}= u_{n}e^{hA}B/A(1e^{hA})\), which is the exact solution for this ODE system.
 Parameters
f (function) – The derivative function.
dt (optional, float) – The numerical precision.
var_type (optional, str) – The variable type.
show_code (bool) – Whether show the code.