Runnable example
Robertson’s problem, solved three ways.
Robertson’s autocatalytic reaction is a standard test for stiffness. Its rate constants span nine orders of magnitude, so the fast transient is over in microseconds while the slow part runs out to seconds. Below, the same system is solved three ways with Reineur Solver, a numerical library for C#.
In the differential-algebraic form the third equation is replaced by the conservation constraint , which makes the mass matrix singular.
The code is editable. Replace it with any problem and press Run. It compiles and runs on a server, so there is nothing to install and no account to create.
Mass-matrix form. The third equation is the algebraic constraint y₁ + y₂ + y₃ = 1, so M is singular and the system is an index-1 DAE.
Result
Press Run to solve this system.
Output and any plot will appear here.
Method vs method
Comparing methods on the same problem
Most results in numerical methods come from comparing two approaches on a problem chosen to show the difference between them. Both sides below actually run. Edit either one and press Run.
Why can't you just use a general-purpose solver?
Van der Pol at mu = 100 is stiff: the solution has a fast transient riding on a slow limit cycle. Both solvers below get the right answer. Watch what it costs the explicit one.
Explicit Runge-Kutta
Ode45Not run yet
Stiff solver
Ode43sNot run yet
