Skip to main content
Share Your Experience: Take the 2024 Developer Survey
87 votes
Accepted

What does "symplectic" mean in reference to numerical integrators, and does SciPy's odeint use them?

Let me start off with corrections. No, odeint doesn't have any symplectic integrators. No, symplectic integration doesn't mean conservation of energy. What does ...
Chris Rackauckas's user avatar
43 votes
Accepted

Which Runge-Kutta method is more accurate: Dormand-Prince or Cash-Karp?

Since I just finished optimizing a lot of them in software, DifferentialEquations.jl, I decided to just lay out a comparison of the main Order 4/5 methods. The Fehlberg method was left out because it'...
Chris Rackauckas's user avatar
21 votes
Accepted

Why are higher-order Runge–Kutta methods not used more often?

There are thousands of papers and hundreds of codes out there using Runge-Kutta methods of fifth order or higher. Note that the most commonly used explicit integrator in MATLAB is ODE45, which ...
David Ketcheson's user avatar
21 votes
Accepted

What is the state of the art in solving stiff initial value problems?

So there is a ton to say about this, and we will actually be putting a paper out that tries to summarize it a bit, but let me narrow it down to something that can be put into a quick StackOverflow ...
Chris Rackauckas's user avatar
18 votes

What does "symplectic" mean in reference to numerical integrators, and does SciPy's odeint use them?

To complement Chris Rackauckas answer, to state some of the mathematical nonsense as well as some stuff you almost certainly know, a dynamical system is Hamiltonian if there is a description with ...
origimbo's user avatar
  • 2,249
18 votes
Accepted

Why is RK45 used as the "default" method for non-stiff ODEs rather than a multistep one?

First, let's establish that they are a good choice. The SciMLBenchmarks are probably the most comprehensive that there are as of right now for modern methods. This uses the vast number of methods ...
Chris Rackauckas's user avatar
17 votes

Why are higher-order Runge–Kutta methods not used more often?

The Benchmark Setup In the Julia software DifferentialEquations.jl we implemented plenty of higher order methods, including the Feagin methods. You can see it in our list of methods, and then there ...
Chris Rackauckas's user avatar
16 votes

Why does the numerical solution of an ODE move away from an unstable equilibrium?

Note that $\pi/2$ is represented in double precision format in a way that is not exactly equal to $\pi/2$. It's only accurate to about 15 digits. Thus you're starting every so slightly away from the ...
Brian Borchers's user avatar
15 votes
Accepted

Why does the numerical solution of an ODE move away from an unstable equilibrium?

I think the two main points have already been made by Brian and Ertxiem: your initial value is an unstable equilibrium and the fact that your numerical computations are never really exact provides the ...
Daniel's user avatar
  • 1,273
14 votes

Options for solving ODE systems on GPUs?

DifferentialEquations.jl library is a library for a high level language (Julia) which has tools for automatically transforming the ODE system to an optimized version for parallel solution on GPUs. ...
Chris Rackauckas's user avatar
14 votes
Accepted

Are stiffness and instability equivalent?

There are non-stiff problems which are unconditionally unstable with some explicit methods, and conversely there are stiff problems which can be stable with explicit methods. Consider the oscillating ...
helloworld922's user avatar
13 votes

Why are higher-order Runge–Kutta methods not used more often?

As long as you're using standard double precision floating point arithmetic, very high order methods aren't needed to get a solution with high accuracy in a reasonable number of steps. In practice I ...
Brian Borchers's user avatar
13 votes
Accepted

Comparing Algorithmic complexity, ODE Solvers (Big O)

odeint from the SciPy library defaults to the lsoda integrator described here. However, any simple description of asymptotic ...
Chris Rackauckas's user avatar
13 votes
Accepted

Why is the central difference method dispersing my solution?

I'll write the equation short as $$\ddot x(t)+c\dot x(t)=a(t,x(t))$$ to separate the "easy" linear parts from the non-linear and forcing terms. On the first method The claimed order of the ...
Lutz Lehmann's user avatar
  • 6,109
12 votes
Accepted

ODEs vs DAE vs ADE?

At least one difference is that in a system of ODEs, all the equations are differential, e.g.: $$ \dot{x}=f(x,y)\\ \dot{y}=g(x,y) $$ whereas the definition of DAEs that I'm familiar with includes ...
Bill Barth's user avatar
  • 10.9k
11 votes

What is “tolerance” in ODE45 in Matlab?

And, it is my understanding that the 4 and the 5 are for the order of the global and local error, respectively. Your understanding is wrong. The local error of a Runge–Kutta method of order $n$ is ...
Wrzlprmft's user avatar
  • 2,022
10 votes

Do there exist low-storage Runge–Kutta methods with an order larger than four?

This area has been fairly well researched, you may check e.g. Ketcheson's review of such methods: https://doi.org/10.1016/j.jcp.2009.11.006 which does contain some low-storage Runge-Kutta methods ...
Reid.Atcheson's user avatar
10 votes
Accepted

Going back in time in an initial value problem

This is technically still an IVP if you do an appropriate change of variables. Given your time is between $t \in [t^*, 0]$, make a new time variable $\tau = -t$ so that $\tau \in [0, -t^*]$ and you ...
spektr's user avatar
  • 4,248
9 votes

Methods for solving $x'=Ax+b$ for small, sparse, singular $A$

Any general-purpose ODE solver should be able to handle this linear coupled system of ODE very easily, for example: scipy.integrate.ode CVODE from the Sundials solver suite; it appears to have Python ...
Kirill's user avatar
  • 11.4k
9 votes
Accepted

4th order Runge-Kutta for $y' = y$

The answer is quite simple. You are already comparing apples and oranges in the first equation. Garbage in, garbage out. The equation $y'=y$ if written properly is $$dy/dx=y.$$ Do you see it now? To ...
Kartik's user avatar
  • 206
9 votes
Accepted

Is there any explicit symplectic Runge-Kutta method?

There are explicit, symplectic methods for certain types of Hamiltonian problems. For example, the symplectic Euler method \begin{align} p_{n+1} &= p_n - h H_q(p_{n+1}, q_n) \\ q_{n+1} &= ...
Daniel's user avatar
  • 1,273
9 votes
Accepted

Special-case Runge-Kutta methods to exploit structure in linear ODE?

There are many kinds of RK methods that have extensions to exploit linearity. They all use some form of exponential or Lie Group idea (again exponential) to do so. Thus they generally do some form of ...
Chris Rackauckas's user avatar
8 votes
Accepted

Computational time not proportional to integration interval in ODE-solver?

Substantially edited, since the original poster changed his equation... In general, the MATLAB (and Octave) ODE solvers dynamically adjust the step size as needed to maintain an accurate solution. ...
Brian Borchers's user avatar
8 votes

ODEs vs DAE vs ADE?

Differential-algebraic equations (DAE) are equations of the form $F(t,x,x')=0$, with the unknown function being $x(t)$. So in a way are generalizations of ODEs. A nice place to start is here. On the ...
adhalanay's user avatar
  • 183
8 votes
Accepted

Why does LSODA fail to integrate the logistic function?

When you use $r=5$, the initial condition is $$ x(-10) \approx e^{-50} \approx 1.9\times 10^{-22}. $$ This is much smaller than the machine epsilon, $2\times 10^{-16}$, and it is very likely that ...
Kirill's user avatar
  • 11.4k
8 votes

Will the numerical solving of the differential equation be wrong if I take the step too small?

Using too small of a timestep can lead to accuracy issues due to finite precision. Since you can use derivative approximations to derive time integration schemes, it is fair to look at how derivative ...
spektr's user avatar
  • 4,248
8 votes
Accepted

ODE45: doubts about the result. Correct or not?

I ran your same code in Python ...
nicoguaro's user avatar
  • 8,525
8 votes

ODE $x''(t)+\eta x'(t)+x(t)=0$ with the $\eta$ extremely small

The problem you have is what is called "stiff": it has two time scales, namely one for the oscillation (which is ${\cal O}(1)$) and one for the damping (which is ${\cal O}(\eta^{-1})$). If $\eta$ is ...
Wolfgang Bangerth's user avatar
8 votes
Accepted

How well do explicit Runge-Kutta "tableau" methods compare to the state of the art ODE solvers and when do they fail?

I think the confusion here is what exactly is a "tableau method" since it's used in our docs in a very specific way. A "tableau method" in DifferentialEquations.jl parlance is a method which is ...
Chris Rackauckas's user avatar
8 votes
Accepted

Is there a database/website with Butcher tableaus?

The three best sources of Butcher tableaus are, according to me, the reference books Numerical Methods for Ordinary Differential Equations, 3rd ed., J.C. Butcher, Solving Ordinary Differential ...
GertVdE's user avatar
  • 6,149

Only top scored, non community-wiki answers of a minimum length are eligible