Questions tagged [runge-kutta]

Runge–Kutta methods are an important family of implicit and explicit iterative methods, which are used in temporal discretization for the approximation of solutions of ordinary differential equations.

In numerical analysis, the Runge–Kutta methods (German pronunciation: [ˌʁʊŋəˈkʊta]) are an important family of implicit and explicit iterative methods, which are used in temporal discretization for the approximation of solutions of ordinary differential equations. These techniques were developed around 1900 by the German mathematicians C. Runge and M. W. Kutta.

Wikipedia definition about Runge-Kutta

379 questions
25
votes
3 answers

Why is Verlet integration better than Euler integration?

Can someone explain to me why Verlet integration is better than Euler integration? And why RK4 is better than Verlet? I don't understand why it is a better method.
13
votes
2 answers

Bezier Cubic Curves: moving with uniform acceleration

Let's say I have a Bezier curve B(u), if I increment u parameter at a constant rate I don't obtain a costant speed movement along the curve, because the relation between u parameter and the point obtained evaluating the curve is not linear. I've…
Heisenbug
  • 38,762
  • 28
  • 132
  • 190
9
votes
2 answers

Absolute error of ODE45 and Runge-Kutta methods compared with analytical solution

I would appreciate if someone can help with the following issue. I have the following ODE: dr/dt = 4*exp(0.8*t) - 0.5*r ,r(0)=2, t[0,1] (1) I have solved (1) in two different ways. By means of the Runge-Kutta method (4th order) and by means…
8
votes
1 answer

How does odeint() from scypy python module work?

I am a physics student interested in solving ODEs numerically. I usually write my own solvers in C using Runge–Kutta methods. I recently learned Python, and I used SciPy’s odeint function to solve ODEs. But I am worried about how the function…
7
votes
3 answers

Runge–Kutta RK4 not better than Verlet?

I'm just testing several integration schemes for orbital dynamics in game. I took RK4 with constant and adaptive step here http://www.physics.buffalo.edu/phy410-505/2011/topic2/app1/index.html and I compared it to simple verlet integration (and…
Prokop Hapala
  • 2,424
  • 2
  • 30
  • 59
6
votes
3 answers

Using lambda functions in RK4 algorithm

There are two ways of implementing the classical Runge-Kutta scheme in Python showed here. The first using lambda functions, the second without them. Which one is going to be faster and why exactly?
Victor Pira
  • 1,132
  • 1
  • 10
  • 28
5
votes
1 answer

How to implement adaptive step size Runge-Kutta Cash-Karp?

Trying to implement an adaptive step size Runge-Kutta Cash-Karp but failing with this error: home/anaconda/lib/python3.6/site-packages/ipykernel_launcher.py:15: RuntimeWarning: divide by zero encountered in double_scalars from ipykernel import…
ZelelB
  • 1,836
  • 7
  • 45
  • 71
5
votes
1 answer

Runge-Kutta 4th order method to solve second-order ODES

I am trying to do a simple example of the harmonic oscillator, which will be solved by Runge-Kutta 4th order method. The second-order ordinary differential equation (ODE) to be solved and the initial conditions are: y'' + y = 0 y(0) = 0 and y'(0) =…
pmoreira
  • 175
  • 1
  • 2
  • 7
5
votes
3 answers

Runge-Kutta algorithm C++

Below is my 4th order Runge-Kutta algorithm to solve a first order ODE. I am checking it against the wikipedia example found here to solve: \frac{dx}{dt} = tan(x) + 1 Unfortunately it is out by a little bit. I have toyed around for a long while,…
PeterSM
  • 143
  • 2
  • 6
5
votes
2 answers

Why is my implementation of the fourth-order Runge-Kutta method not working?

After searching in this site and on my reference book, I found out I have no idea why my code is not working. I made a fourth-order Runge-Kutta implementation for the mass-spring system (with amortization), as my professor showed us in class.…
user2505778
4
votes
6 answers

How to set fixed step size with scipy.integrate?

I am looking for a way to set a fixed step size for solving my initial value problem by Runge-Kutta method in Python. Accordingly, how I can tell the scipy.integrate.RK45 to keep a constant update (step size) for its integration procedure? Thank you…
behzad baghapour
  • 127
  • 2
  • 11
4
votes
2 answers

Solve a system of equations with Runge Kutta 4: Matlab

I want to solve a system of THREE differential equations with the Runge Kutta 4 method in Matlab (Ode45 is not permitted). After a long time spent looking, all I have been able to find online are either unintelligible examples or general…
gelbrekt
  • 179
  • 1
  • 2
  • 10
4
votes
0 answers

Integration of orbits with solar system gravity fields from Skyfield - speed issues

In the time tests shown below, I found that Skyfield takes several hundred microseconds up to a millisecond to return obj.at(jd).position.km for a single time value in jd, but the incremental cost for longer JulianDate objects (a list of points in…
uhoh
  • 3,713
  • 6
  • 42
  • 95
4
votes
1 answer

Simulink simulation behaving massively different than the same simulation using rk4

I have difficulties simulating an object discribed by the following state space equations in simulink: The right hand side of the state space equation is described by the funcion below. function dxdt = RHS( t, x, F) % parameters b = 1.22; %…
Lukasz
  • 2,257
  • 3
  • 26
  • 44
4
votes
6 answers

What is wrong with my gravity simulation?

As per advice given to me in this answer, I have implemented a Runge-Kutta integrator in my gravity simulator. However, after I simulate one year of the solar system, the positions are still off by cca 110 000 kilometers, which isn't acceptable. My…
corazza
  • 31,222
  • 37
  • 115
  • 186
1
2 3
24 25