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

How can I solve this third order equation using the ODE45 function?

When I convert the third order ODE into a system of first order ODEs, I got this: x1' = x2; x2' = x3; x3' = R1*x1+R2*x2-alpha*x3; x4' = 1; where x4 = t; R1 = -0.000001*(1-cos(theta*x4))-theta*sin(theta*x4)+1; R2 = -(1-cos(theta*x4));
Leandro
  • 3
  • 2
-1
votes
1 answer

Exploding Runge Kutta Method

I've been attempting to build a Runge Kutta fourth order integrator to model simple projectile motion. My code is as follows double rc4(double initState, double (*eqn)(double,double),double now,double dt) { double k1 = eqn(initState,now); …
user3277807
  • 63
  • 1
  • 1
  • 11
-1
votes
1 answer

I'm trying to solve ode45 by this expression

Can I use this form when i need to solve system of ODE by ode45 on MATLAB dy(3)=dy(1)*dy(2)+y(3)*y(2) I mean is my expression correct? For example how can I solve this: dy(3)=dy(1)*dy(2)+y(1) dy(2)=dy(1)-y(2) dy(1)=dy(2)+dy(3)/y(1) initial…
-1
votes
2 answers

Subscript out of range in Runge Kutta method

I am programming the Runge Kutta method with adaptive step size in VBA and I have encountered an Error 9 "Subscript out of range". Can someone please help me figure out why and how to fix it? I am attaching the three separate sub routines I was…
-2
votes
1 answer

An array with real subscripted variable

I have problem using the results of a subroutine in the main program. I wrote this code: Program RK4 implicit none real k1,k2,k3,k4,h,t,R integer i,n real a read*,n,h t=0 R=0 Do i=1,n call Scale_Factor(h,n,t,a) k1=h*(1/a(t)) …
-2
votes
1 answer

ODE solver using Lobatto IIIA with table of coefficients

So I'm trying to figure out how to solve a given equation y'=-y+2te^(-t+2) for t in [0,10], step of 0.01 and y(0)=0. I am supposed to solve it using the Lobatto IIIA method following a Butcher tableau: Coefficients table So far, this is what I…
-2
votes
1 answer

Runge-Kutta 4 in python

I have a question, in the code, for h=0.1 shows a minor error that h=0.01 and h=0.001. I don't understand why?, but with h=0.0001 the error again decreases. thanks! def f(x,y): return 2*x**2-4*x+y def RK4(x0,y0): while x0 < b: k1 =…
user161524
  • 11
  • 1
-2
votes
1 answer

Runge-Kutta method on c++

i'm trying to code a simple runge-kutta method The function to be approximated and the runge-kutta method are separate definitions, which are called within the loop in the main function. approximate solutions for y and t are pushed into a separate…
Erez Sabran
  • 13
  • 1
  • 7
-2
votes
1 answer

2nd order ODE using Runge-Kutta method in C

I want to model the motion of a particle using a set of 2nd order equations the the equation is d2x/dt2 = 1 + dy/dt + dz/dt d2y/dt2 = 1 + dx/dt + dz/dt d2z/dt2 = 1 + dx/dt + dy/dt vector V is (dx/dt dy/dt dz/dt), X is (x y z), V = [0 0 0], X =…
-2
votes
1 answer

Adaptive Stepsize Method for 5th Order Runge-Kutta Method in Fortran

I want to solve a set of equations using 5th order Runge-Kutta method with adaptive stepsize method. I have found a useful code written by Taner Akgun. Here is the code: c c Adaptive Size Method for 5th Order Runge-Kutta Method c (Based on Numerical…
-2
votes
1 answer

Inizialize a complex array

I'm trying to solve a system of complex differential equation. I would like to fill the complex vector xi[n] with a gaussian valued function. But, when I check the output file, it gives me just a lot of zeros. I gave the input values using the cin…
-3
votes
1 answer

Fortran code for RK4 method which does not answer correctly for different initial values

I wrote this code in Fortran: Program RK4 implicit none real x,y,k1,k2,k3,k4,h integer i,n real f read*,n,h x=0 y=0.001 Do i=1,n k1=h*f(x,y) k2=h*f(x+h/2.0, y+k1/2.0) k3=h*f(x+h/2.0, y+k2/2.0) k4=h*f(x+h, y+k3) …
Elham Q
  • 5
  • 1
-3
votes
1 answer

RK4 Python Explanation

I'd like to use an implementation of RK4 I found online for something, but I'm having a bit of difficulty wrapping my head around the implementations I have found online. For example: def rk4(f, x0, y0, x1, n): vx = [0] * (n + 1) vy = [0] *…
-4
votes
2 answers

Right Runge Kutta 4th method approach?

I have this runge kutta code. However, one mentioned my approach is wrong. And I couldn't really understand why from him, so anyone here, who could give a hint on why this way is wrong? Vector3d r = P.GetAcceleration(); Vector3d s =…
user2180833
  • 156
  • 2
  • 11
-4
votes
1 answer

Implementation of Runge Kutta Fourth Order in c++

So I should start by saying that this is my first attempt a executable script, and my first ever c++ script. Bearing this in my mind my problem is as follows. I'm attempting to create a script which shall integrate projectile motion with the use of…
user3277807
  • 63
  • 1
  • 1
  • 11
1 2 3
24
25