Skip to main content

Questions tagged [runge-kutta]

The Runge–Kutta methods are a set of numerical methods for ordinary differential equations for the approximation of their solutions.

Filter by
Sorted by
Tagged with
3 votes
2 answers
1k views

10th-order Runge-Kutta Method

I want to apply the 10th-order Runge-Kutta method, but I am having trouble finding the coefficients. I read Ernst Hairer's article, he used the stage s=17 and ...
Rodolfo Godoy's user avatar
1 vote
1 answer
55 views

How to solve three coupled differential equations in python using RK-4 and shooting method? or using solve_bvp?

I am trying to solve three coupled differential equations in Python. I am using RK-4 techniques with Shooting method. I am trying to plot the f and N functions. ...
Prosenjit Paul's user avatar
1 vote
1 answer
87 views

Solving TOV equations that describes neutron stars in modified f(R, T) gravity

Sorry for the long post, tldr at bottom. I'm trying to use standard RK4 code in C/C++ to solve a coupled system of 2 modified TOV equations in f(R,T) gravity and reproduce some of the results of this ...
hidenori's user avatar
6 votes
2 answers
377 views

Order of numerical solver when calculating difference between forwards and backwards solution

I'm working in applied oceanography, where people are sometimes interested in calculating ``backwards trajectories'' of things floating on the ocean, i.e., going backwards in time to figure out where ...
Tor's user avatar
  • 243
0 votes
1 answer
65 views

solve_ivp method=ODE23 time step not decreasing in order

My time step with the function scipy.integrate.solve_ivp is not decreasing in t_span fluctuating (reaching values below or ...
louis gouders's user avatar
0 votes
1 answer
79 views

How to modify adaptive step size Runge-Kutta cash karp algorithm for higher accuracy?

I'm following a paper on making your own cosmic microwave background perturbation solver code by Peter Callin https://arxiv.org/pdf/astro-ph/0606683.pdf In the programming techniques section V, the ...
hidenori's user avatar
1 vote
1 answer
119 views

Can I combine the backward and forward euler methods - simialr to modified euler method?

Constructing Modified Euler Using the same strategy as done in the construction of Modified Euler. Starting from Trapezoidal Method $$y_1 = y_0 + \dfrac{h}{2}\left(f(x_0,y_0) + f(x_1,y_1)\right)$$ ...
ray_lv's user avatar
  • 11
6 votes
2 answers
722 views

What is the advantage of using a particular RK Scheme?

The Wikipedia article on Runge-Kutta Methods lists several examples of each order. My question is, are there any particular advantages using one particular scheme over another of the same order? I ...
Jacob Ivanov's user avatar
2 votes
1 answer
103 views

From Runge-Kutta Butcher tableau to general linear methods matrices?

I am trying to understand how the relationship between Butcher tables for Runge-Kutta methods and their generalization to general linear methods matrices (by Butcher also). Runge-Kutta methods can be ...
Vincent's user avatar
  • 343
1 vote
1 answer
109 views

Educational Purpose: How to synchronize chaotic systems

The graph plots the X coordinate of the synchronized Lorenz chaotic system. I am self learning by reading research articles on how to synchronize identical chaotic systems. But as seen from the figure,...
Sm1's user avatar
  • 119
2 votes
1 answer
134 views

Can the Runge-Kuta algorithm help in reducing numerical dispersion and anisotropy when using the FDM to solve the 2D wave equation? [closed]

I am currently studying the effects of group velocity on the finite difference solution of the wave equation. Most of what I learned is from this source. I understand that high frequency components in ...
Amilox Lex's user avatar
2 votes
2 answers
80 views

How to improve and stabilize this code simulating a damped mass-spring oscillator? Runge-Kutta?

I wrote the following function which is simulating a damped mass-spring oscillator. It is being driven by the audio sample input at 44.1 kHz sampling to create the same effect as a resonant bandpass ...
mikejm's user avatar
  • 123
1 vote
2 answers
130 views

How to estimate the stage error for Runge kutta method

Consider an ordinary differential equation (ODE) in the form $u_t=g(t,u(t))$ and apply the explicit Runge-Kutta method, as defined by the following Butcher tableau: $$ \mathrm{RK}(s,p):\begin{array}{c|...
Owen Jun's user avatar
  • 141
0 votes
0 answers
56 views

ENO-Runge-Kutta discretization

One beginner's question about discretization of a Hamilton-Jacobi equation(non-linear) $$ u_t = H(u_x) $$ $u_x$ is discreated with 2nd order ENO-FD 1st order: $D_1^{\pm}u = \pm [u_{x\pm1} - u_x ] / \...
solanin's user avatar
1 vote
2 answers
126 views

Is there any way to reduce an RK4 method's dependence on step size?

I am working in the sphere of orbital simulations, where orbital trajectories are computed using the differential equations describing gravity. Due to the great timescales of orbits, a step size of ...
JS4137's user avatar
  • 133
4 votes
1 answer
231 views

Estimating the spectral radius when applying the method of lines

Some time integrators, notably the Runge-Kutta-Chebyshev method, implemented in the RKC code from Sommeijer & Verwer, gives the user an option to provide a callback with an estimate of the ...
IPribec's user avatar
  • 637
2 votes
1 answer
181 views

Does this second-order implicit Runge-Kutta method have a name?

I am studying the time-integration of the following paper, Young, L. C. (1981). A finite-element method for reservoir simulation. Society of Petroleum Engineers Journal, 21(01), 115-128. A copy (PDF)...
IPribec's user avatar
  • 637
2 votes
0 answers
106 views

Runge Kutta 4th order: unexpected result

My problem in brief: in some situations, the Runge Kutta 4th order method (RK4) doesn't seem to give 4th order improvement when using a smaller time step. I wonder how this worse-than-expected result ...
gamma1954's user avatar
  • 121
6 votes
0 answers
147 views

Runge-Kutta methods, higher derivative methods, and collocation methods

Consider an ODE system $$\dot x = f(t, x), \quad x(0) = \xi.$$ A collocation method to solve this ODE (1) assumes that $x$ can be approximated as a polynomial $x(t) \approx \sum_kx_kp_k(t)$ and (2) ...
Daniel Shapero's user avatar
1 vote
0 answers
79 views

Solving perturbed Einstein Boltzmann equations using RK4

I'm trying to learn to numerically solve the perturbed Boltzmann-Einstein equations in cosmology using the RK4 method. These are the equations: $$\dot{\Theta}_{r,0}+k\Theta_{r,1}=-\dot{\Phi}$$ $$\dot{\...
hidenori's user avatar
2 votes
1 answer
173 views

Runge Kutta Procedures for Incompressible Navier Stokes

I was playing a little bit with the Runge-Kutta procedure for the Incompressible Navier-Stokes equation and came up with something strange, so I would like to know where I'm wrong or doing something I ...
Marco's user avatar
  • 23
2 votes
0 answers
70 views

Order of local error when integrating ODE with discontinous derivatives

I'm working with ODEs, $$\dot{x} = f(x, t),$$ where the (higher) derivatives of the right-hand side have discontinuities. In particular, $f(x, t)$ is obtained by interpolation of discrete samples, and ...
Tor's user avatar
  • 243
2 votes
1 answer
256 views

Motion of the particle trapped in potential

I have lots of difficulties trying to make a phase plot for the motion of the particle trapped in Lennard-Jones potential: $$V(q)=\epsilon\left[\left(\frac{q_\mathrm{min}}{q}\right)^{12}-2\left(\frac{...
Jimmy Yang's user avatar
1 vote
2 answers
2k views

Fix step size with scipy.integrate.RK45 and scipy.integrate.LSODA

I am trying to numerically integrate a differential equation using scipy.integrate.RK45 and/or scipy.integrate.LSODA. Now, I am trying to fix the integration step sizes of both solvers. This, however, ...
Octavius's user avatar
  • 185
8 votes
2 answers
2k views

Energy conservation in RK4 integration scheme in C++

My colleague and I are trying to study the three-body problem, with different integration schemes, starting from the two-body problem. We implemented the symplectic Euler scheme and the Runge–Kutta ...
jack23456's user avatar
  • 171
1 vote
1 answer
609 views

RK4 integration of the three-bodies problem with C++

first of all thank you for all the answers you gave me yesterday for the integration via Symplectic Euler's method of the three-body problem. We managed to implement both Euler's and Runge Kutta 4's ...
jack23456's user avatar
  • 171
2 votes
0 answers
60 views

Dispersion of Runge-Kutta methods when applied to systems of ODEs

I am interested in computing the dispersion / phase error(s ?) of an (explicit) Runge-Kutta method when applied to a linear system of ODEs $$ u'(t) = A u(t). \tag{1} \label{1} $$ To begin, consider ...
Dan Doe's user avatar
  • 1,093
4 votes
1 answer
106 views

Stabilized Many Stage Runge-Kutta methods instead of Local/Multirate Time Stepping

Locally refined meshes are often inevitable for accurate, yet feasible computations. In the context of time-dependent PDEs, however, this comes at the cost that (due to the CFL condition) reducing the ...
Dan Doe's user avatar
  • 1,093
-1 votes
1 answer
60 views

What is the ERRCON parameter in rkqs?

Ive take a course in computational physics and was asked to implement some numerical methods to solve ODES. I was reading up on the algorithms described in the textbook: NUMERICAL RECIPES IN FORTRAN. ...
Vishal Jain's user avatar
1 vote
0 answers
198 views

Solving 1D Advection Equation Using Midpoint-Rule and Finite-Differences

I want to solve the advection equation ($v_0 \in \mathbb R$) $$ \frac{\partial f}{\partial t} + v_0 \frac{\partial f}{\partial x} = 0 $$ using 2nd order Runge Kutta like the midpoint rule for the time ...
xotix's user avatar
  • 241
2 votes
1 answer
803 views

Why is my Runge-Kutta 4 solution to the 1-D advection equation decaying so quickly?

I am trying to numerically solve the advection equation $y_t + y_x = 0$ using a the "classical" Runge-Kutta 4 explicit timestepping method, along with a left-hand finite difference ...
bosco98's user avatar
  • 23
1 vote
1 answer
97 views

Direct integration of 2D Euler Equations with Runge Kutta shows oscillating Courant-Friedrichs-Lewy coefficient. Stiff or Bug?

By writing the direct integration of the 2D Euler Equations in a wide and short box where the fluid enters and exits through the horizontal faces using the Runge Kutta O(4) method I have found that ...
Gaston's user avatar
  • 113
11 votes
2 answers
2k views

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

From what I read, the "default" go-to method for non-stiff ODEs is the Dormand-Prince Runge-Kutta pair; for instance, in Matlab docs, "Most of the time, ...
Federico Poloni's user avatar
2 votes
0 answers
160 views

Jacobian matrix cutoff in ODE solver

I am studying an implementation of a 3rd semi-implicit Runge Kutta method (siRK3) from the book by Villadsen & Michelsen (1978), Solution of differential equation models by polynomial ...
IPribec's user avatar
  • 637
2 votes
1 answer
1k views

N-body problem with differents solvers (RK2, RK4, Euler symplectic, Stormer-Verlet) : planets drift to infinity

I'm trying to write an integrator for the 2 and 3-body problem. I choose to start from a generalisation to N-body problem so I can just pass my bodies to the same integrator in the two cases. I'm ...
Mathieu Rousseau's user avatar
2 votes
0 answers
163 views

Divergence on wave equation simulation

I'm currenly working on my own PDE solver for non-linear simulations in python. I've done succesfully simulations for KdV and Fisher's equation, but now I'm playing with second order derivatives in ...
Rafael Riveros Ávila's user avatar
0 votes
1 answer
225 views

Perturbation problem using Runge-Kutta 4

I'm trying to evaluate the perturbations magnitude between 2 body orbiting a central one in three dimensions. In order to do this I need to have an estimate of the error, which I did using Richardson ...
Zebx's user avatar
  • 101
6 votes
1 answer
481 views

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

I am interested in numerical solutions of a linear, time-dependent ODE of the form $$ \dot y = A(t)y - Ry, $$ A good model is the following problem in $\mathbb R^2$: $$ A(t) = \begin{bmatrix}0 & -\...
johannestoger's user avatar
3 votes
2 answers
483 views

Using the BDF and RK4 methods to solve this coupled system of ODEs in C++

I'm trying to solve a system of ODEs using the BDF order 4 method. I find the first 3 points using RK4, then for the implicit part of the BDF, I use Newton-Raphson iteration. Unfortunately my solution ...
Michael B's user avatar
2 votes
1 answer
164 views

What is the derivation of the values of a1, a2, p1 and 11 in the Second Order Runge Kutta Method?

So currently I am studying about the Runge Kutta Second Order Method used to estimate first order ordinary differential equations. The following show the formulas. $$ y_{i+1} = y_i + (a_1k_1+a_2k_2)h $...
AndroidV11's user avatar
0 votes
1 answer
2k views

Python evaluating a second order ODE with RK4

Pasted below is my python code. It is a 4th order runge kutta that evaluates the 2nd order ode: y'' +4y'+2y=0 with initial conditions y(0)=1, y'(0)=3. I need help fixing it. When I run my code, my ...
J Wright's user avatar
3 votes
1 answer
160 views

How to get a more accurate cancelation

I shall try to get to the point, so let me know if there is something left and you need more details. I am solving a couple of equations that are not coupled explicitly, but their corresponding ...
user avatar
1 vote
1 answer
990 views

DOP853 integration method is missing (SciPy)

I was checking some integration methods provided by SciPy, in which the DOP853 should be included according to the webpage (https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate....
user avatar
1 vote
1 answer
552 views

Coupled second-order differential equations using runge kutta 45

As a little summer project I have tried to make a ballistic calculator for when I play football, (following an example from a book), just to learn some numerical methods while doing so. My problem is ...
Peter's user avatar
  • 33
1 vote
1 answer
107 views

How is the final result calculated in RK-Dopri(4,5)?

I have found a toy implementation of RK-Dopri(4,5), written in Python. I am concerned however, about line 118: y = y + h * (b1*K1+b3*K3+b4*K4+b5*K5+b6*K6) Has the ...
bzm3r's user avatar
  • 659
1 vote
0 answers
111 views

RK4-method starts oscillating above certain input parameters

I am trying to solve an equation of the following type $$\partial_zE(z)=-c_0J$$ with $$J=c_1\beta E^3(z)$$ using the boost::odeint-framework and a fixed time stepper, with $c_0$, $c_1$ and $\beta$ ...
arc_lupus's user avatar
  • 563
0 votes
1 answer
164 views

Method of Lines Runge-Kutta nonlinear stability and behavior

I have a system of 4 nonlinear 1st-order PDEs. I want to solve them numerically by method of lines, first discretizing space. This leads to the system of $N\times 4$ coupled ODEs. $$ \mathbf{u}_{i} =...
user8384493's user avatar
0 votes
1 answer
252 views

Two RK4 method in one program

I want to solve this integral using RK4 by coding in Fortran: $$R=∫1/a(t) dt → dR/dt=1/a(t) =f(t)$$ Initial point: t=0 (or a=0.001) and R=0 And I have to get a(t) by solving another ...
Elham Q's user avatar
  • 11
3 votes
1 answer
200 views

Time independent Runge Kutta integration of SDE

I am trying to compare the result of numerical integration of time independent Runge_Kutta, github page for stochastic differential equations with the analytical solution. True answer match the ...
Abolfazl's user avatar
  • 131
1 vote
3 answers
218 views

Runge-Kutta method for an ODE with initial value which is root of denominator

I wrote a code in Fortran to solve this differential equation using RK4 method: $$ \frac{dy}{dx}=A\sqrt{\frac{B}{y}+\frac{C}{y^2}} $$ $A$, $B$, and $C$ are some known constants. The problem is that ...
Elham Q's user avatar
  • 11