New answers tagged

1 vote

Inaccurate results of integration using scipy solve_ivp

As the initial value problem was given and very well specified, the analytical solution can be easily calculated, where $y(t) = (1+2.5t)^{1.4}$ solution of the PVI problem, by the way, $\rho = y$ and $...
7 votes
Accepted

Convergence-test for ODE approximates wrong limit

The Euler method has global error order 1, not 2 To get step size $h=1/N$, you need $N$ steps, which gives $N+1$ nodes in the time subdivision. Currently you compare sequences with step sizes $\frac1{...
  • 4,404
3 votes

Using backward and forward Euler method to solve a certain stiff ODE

One of the many definitions of stiffness is that implicit (A-stable ones in particular) methods solve the system dynamics much more efficiently than explicit ones. In the case of stiff ODEs, an A-...
  • 1,649
0 votes

Python evaluating a second order ODE with RK4

Well, your problem is the numerical solution to an initial value problem. First, we must transform the second-order ODE into a 2x2 system of first-order ODE. Note that despite the transformation, the ...
6 votes
Accepted

Using backward and forward Euler method to solve a certain stiff ODE

General observations Convergence If $L$ is a Lipschitz constant for the system that is valid for the medium term, then with $Lh\le 1$ both methods give with good probability (but not certainty) ...
  • 4,404
2 votes

Scipy solve_ivp sensitivity to random phase shifts

I first thought you were integrating an ODE of the type $y'=f(y,p)$ with $p$ some random phase vector drawn at the start of the simulation. Actually, looking at your code, it seems you are not ...
  • 1,649
1 vote

How to extract intermediate calculation results from an SciPy ODE function in python?

There is no simple way of doing this. I see a few solutions though. You could hack this by adding, at each function call, these secondary variables to a global list, along with their time of ...
  • 1,649

Top 50 recent answers are included