91
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 ...
20
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 ...
17
votes
Accepted
CUDA & Python for numerical integration and solving differential equations
Julia's DifferentialEquations.jl is all GPU-compatible. If you make your arrays GPU-based arrays, then the solver recompiles to be all on the GPU (no data transfers). For example:
...
16
votes
Accepted
Numerical integration of ODEs: Why does higher accuracy and precision not lead to convergence?
This is the nature of chaos. the number of digits of precision you need to obtain convergence to time t is often exponential in t.
That said, using better integrators, it is possible to do better.
<...
13
votes
Accepted
How can I numerically integrate the Kepler problem?
I'm going to assume for the moment that your code is correctly implemented and that this problem isn't a bug.
Believe it or not, gradual increase of the energy is the expected behavior of most simple ...
10
votes
Finite difference for 1D wave equation: why the spike initial data results in a noisy output?
I think you're probably seeing artifacts that are due to numerical dispersion. In brief, in the discrete case different (spatial) frequencies of a wave function will propagate at different phase/group ...
10
votes
How to solve a second order differential equation (diffusion) with boundary conditions using Python
I have found that I must keep the value of dt near dx or the results become unstable
This behavior you have noticed is known as the Courant–Friedrichs–Lewy (CFL) condition. Indeed, there are ...
10
votes
Accepted
Time integration of first-order ODE with higher-order information
Not too surprisingly, it is referred to as a
"Taylor series method." The drawback is that, in general, it
may not be easy to compute the derivatives of $F$, particularly as you add more ...
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 ...
9
votes
Accepted
Numerical computation of Lyapunov exponent
It is not the Jacobian of $f$ that you need to use to propagate the local basis, but the Jacobian of the propagator of the numerical method. That is, if
$$
v_1=v_0+\Phi_f(v_0,dt)dt
$$
then
$$
U_1=(I+...
9
votes
Accepted
Why do different ODE solvers give very different solutions to this problem?
In general, if you apply two numerical methods to the same problem and get different answers, there are four possible reasons:
One or both of the implementations has a bug. This is especially likely ...
8
votes
Accepted
Visualizing the solutions of the Differential equations by varying different parameters
You can try Geogebra (it is free). With SolveODE command and sliders you can do what yo want.
For the usage of SolveODE command see. For example by using following command
...
8
votes
Accepted
How do people know the classic Lorenz attractor is actually deterministically chaotic at infinite time?
If I am remembering correctly, periodic orbits are known to be dense and countable in the Lorenz attractor, but are also known to be unstable (The first return map has $|F'| >1$ everywhere). A ...
8
votes
Numerical integration of ODEs: Why does higher accuracy and precision not lead to convergence?
As Oscar states, one of the definitions of chaos is that errors in a trajectory are magnified exponentially in time. However, note that although you lose accuracy on the trajectory, the strange ...
7
votes
Solving coupled differential equations in Python, 2nd order
The first step is to transform the second order equation to a set of two coupled first order equations. Define an auxiliary function $u(T) = \frac{dr(T)}{dT}$. This results in the system
$$\begin{...
7
votes
Specifying ode solver options to speed up compute time
Julia's DifferentialEquations.jl has a lot of tooling for automatically deriving (sparse) matrices. For more information, see the JuliaCon 2020 video on Auto-Optimization and Parallelism in ...
7
votes
Numerical implementation of ODE differs largely from analytical solution
The equation for the square resistance can be easily solved by remembering the pattern $$(e^y)''=e^y\,(y''+y'^2)$$ and considering $u=\exp(-cx)$. This gives $\dot u=cvu$ (with $v=-\dot x$) and
$$\ddot ...
6
votes
Some questions on Trace (operators) on the boundary in the context of PDEs
I think the quote from Wikipedia is misleading (and I should put that on my list of things to fix :-) ). You can think of the trace of a function $u: \Omega \rightarrow {\mathbb R}$ that lives on a ...
6
votes
solve_ivp from scipy does not integrate the whole range of tspan
You can examine the sol object to see why the integration failed. It provides the message 'Required step size is less than spacing between numbers.' This usually ...
6
votes
Accepted
How does non-dimensionalization improve the behavior of ODE solvers?
Background
Let’s have a brief look at what parameters an integrator typically has and what they are used for. All of them govern step-size adaption:
Relative tolerance (...
6
votes
Accepted
Python bifurcation diagram of seasonally forced epidemiological models
Recently in https://math.stackexchange.com/questions/4542008/how-to-loop-parameter-a-in-henon-map I came into contact with the idea of an "adiabatically gliding" parameter where one gets the ...
5
votes
Accepted
Can Runga-Kutta method be used to solve non-linear differential equations?
Runga-Kutta schemes are multistage recipes for numerical discretizations of temporal derivatives. That is they tell to how to solve equations in the form $\dot{\mathbf{y}} = \mathbf{f}(\mathbf(y,t)$. ...
5
votes
Accepted
Numerical integration in 2D
You can convert this equation into a Poisson equation and use standard numerical methods to solve it like finite difference to obtain $\theta(x,y)$. If you take a divergence from both side:
$$\nabla^{...
5
votes
Accepted
Solving the heat diffusion equation with source term
You are starting from a uniform temperature and you have insulated
boundary conditions; so there is no heat conduction occurring.
Likewise, your initial mole fraction is also constant in $x$ so that
...
5
votes
Accepted
scipy odeint: excess work done on this call and very sensitive to initial value
Essentially, by combining all the constant factors, your ODE is
$$
\frac{dL}{dt} = -A + B L + C L^2
$$
With the initial $L(0)=L_0$ large enough, the positive feed-back of the quadratic term drives ...
5
votes
Accepted
How to set up the differential equation system to speed up computation?
Some things I can think of:
use sparse matrices for Matrix1 and Matrix2 to speed up the computations of ...
5
votes
Accepted
2-DOF Robotic Manipulator Trajectory Tracking Simulation
As far as I understand the fist part of your question is regarding the options of the ode15s, and which ones you can use to make the solver more efficient/accurate.
...
5
votes
Numerical integrator for $a'(t)=e^{-a(t)}f(t)$
You want a numerical solution, but this might help you check your computed results.
If $a$ satisfies the ODE, you know $e^{a(t)}a'(t) = f(t)$. Integrating you get
\begin{align}
\int_0^t\, f(\tau)\, d\...
5
votes
Solving numerically the 1D Kuramoto-Sivashinsky Equation using spectral methods
Indeed the problem was that you were trying to calculate your nonlinear term incorrectly and you forgot that:
$$\mathcal{F}[(f(x))^{2}] \neq (\mathcal{F}[f(x)])^{2}$$
I changed your code to this:
<...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
differential-equations × 253numerics × 62
ode × 57
python × 47
finite-difference × 43
computational-physics × 31
finite-element × 21
matlab × 21
nonlinear-equations × 20
scipy × 20
boundary-conditions × 15
runge-kutta × 15
integration × 14
stability × 13
numerical-modelling × 12
pde × 11
time-integration × 10
diffusion × 10
fluid-dynamics × 8
quantum-mechanics × 8
simulation × 7
advection-diffusion × 7
julia × 6
dae × 6
reference-request × 5