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
0
votes
1 answer

Segmentation fault in double pendulum code by Runge-Kutta

I'm trying to numerically solve the double pendulum by Runge-Kutta fourth order. The differential equations to be solved are on the following page: http://www.myphysicslab.com/dbl_pendulum.html There is even an animation showing the angles 1 and 2.…
0
votes
0 answers

Can't solve Jiles-Atherton model with Runge-Kutt 4th order ;(

my problem is following: I need to integrate Jiles-Atherton model(it's described in answer) I used the same parameters as in answer but I got bad results ;( First in my program I increase H from 0 to 2500, then decrease from 2500 to -2500 and then…
Hi4ko
  • 23
  • 2
0
votes
1 answer

Programming RK4, need to print values but within a loop, choosing cell a5 first, and then next cycle it will print to a6, etc

I was wondering whether someone would be able to help me out with a problem I am having with a printing function in excel VBA. I am trying to print out the outputs of an ODE using RK4, and I would like to know how to loop a printvalue function, so…
0
votes
3 answers

Solving a system of second order PDEs using Runge Kutta in C

I have a problem solving a system of differential equations using the Runge Kutta algorithm. So far I have rewritten the second order PDE into a set of two coupled equations where f(L1,L2) = L2 g(L1,L2) = A*(B*L1-C*L2-D) are the two…
MichaelScott
  • 387
  • 1
  • 3
  • 21
0
votes
1 answer

What is the possible source of error in Runge-Kutta 4 algorithm in python for solving SHM

I wrote a simple RK4 program in python to solve SHM equation: y''[t] = -w^2*y[t] by writing: z'[t] = -w^2*y y'[t] = z Following is the RK4 code: def rk4_gen(t, y, z, h): k1 = h*f1(y, z, t) l1 = h*f2(y, z, t) k2 = h*f1(y+k1/2.0,…
mohan_das
  • 25
  • 5
0
votes
1 answer

Solving Bessel Function using Runge Kutta

I'm working on an assignment for a class of mine and I'm supposed to write a code using a program of my choice (I've chosen Matlab) to solve the Bessel function differential equation using the 4th order Runge-Kutta method. For reference the Bessel…
John
  • 33
  • 1
  • 1
  • 4
0
votes
0 answers

Equation of motion by Runge-Kutta continuation method in Matlab

Equation of motion is given by: ,where m, b are stationary values of mass and damping. The time varying term f(t) is excitation power and q(t) is generalized displacement. I solved that: And I should to solve in MatLab via…
MrPitivier
  • 71
  • 9
-1
votes
1 answer

How to speed up this code for Poincare Section using Numba?

I have the following Python code for constructing a Poincare Section for chaotic Pendulum which uses RK4 algorithm and np arrays: import numpy as np import matplotlib.pyplot as plt from matplotlib import cm # Define function to calculate…
-1
votes
1 answer

Simulating orbit of planet around the sun with RK4

I am trying to simulate a planet going around the sun with the RK4 algorithm. This is my code that i tried: import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt def calcvec(x1,y1,x2,y2): r = np.array([0,0,0]) …
chwu
  • 1
-1
votes
1 answer

Applying runge kutta for coupled equations

so I have 2 second order nonlinear ODE and after applying the state-space theorm I have 4 first order ODE. I'm trying to apply RK4 but I think I'm doing it wrong because the graphs diverge. I'm getting a hard time applying it because the equations…
-1
votes
2 answers

how to replace the ode45 method with the runge-kutta in this matlab?

I tried everything and looked everywhere but can't find any solution for my question. clc clear all %% Solving the Ordinary Differential Equation G = 6.67408e-11; %Gravitational constant M = 10; %Mass of the fixed object r = 1; %Distance…
Ali Haydar
  • 13
  • 3
-1
votes
2 answers

How to fix this error: unsupported operand type(s) for ** or pow(): 'tuple' and 'int'

I am trying to solve an ODE with two variables. I do not understand why or how I have created a tuple here. The function f should be f = 10 - x - (4xy / 1+x^2) Could anyone help with this? def RK_step(f, g, x, y, t, dt): x_new = x + dt*f(x…
Tubbit
  • 3
  • 2
-1
votes
2 answers

Runge-Kutta 4th-Order

Right now I am trying to make my Runge-Kutta work. Actually I have to solve a ODE-System which is a lot more complicated than this ODE-System, but the runge-kutta-function is the same. I'm solving this simple system to check if the simulation…
-1
votes
1 answer

Can you check the application of second order runge-kutta method?

def second(y, z, y0, z0, t0, tf, dt): N = (tf-t0)/dt y.append(y0) for i in range(int(N)): t1 = t0 + dt y1 = y0 + z0*dt zk1 = z(t0, y0, z0) zk2 = z(t0+1/2*dt, y0+1/2*dt, z0+1/2*zk1*dt) z1 = z0 + zk2*dt y.append(y1) t0…
-1
votes
1 answer

Index out of bounds in Runge-Kutta algorithm for parabolic shot

Hi I am trying to get this program to run. The z structure is assumed to be size 4, however it gives the error. I also notice that if I print z in 1 it gives me a value, so I do not know what is the flaw. It is a program that calculates, using runge…
alefisto
  • 15
  • 3