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
vote
2 answers

How to create a Single Vector having 2 Dimensions?

I have used the Equation of Motion (Newtons Law) for a simple spring and mass scenario incorporating it into the given 2nd ODE equation y" + (k/m)x = 0; y(0) = 3; y'(0) = 0. I have then been able to run a code that calculates and compares the Exact…
C.L
  • 17
  • 4
1
vote
1 answer

Solving system of coupled differential equations using Runge-Kutta in python

This python code can solve one non- coupled differential equation: import numpy as np import matplotlib.pyplot as plt import numba import time start_time = time.clock() @numba.jit() # A sample differential equation "dy / dx = (x - y**2)/2" def…
1
vote
1 answer

N body simulation in C

I'm trying to write a code to solve the n-body problem using Runge Kutta 4 integration algorithm. I'm testing the code using two bodies with masses uniformly distributed between 0 and 1, position distributed following a density law proportional to…
Maere
  • 11
  • 1
1
vote
0 answers

Correct implementation of a step-size controller for embedded Runge-Kutta methods

I have been trying to write a code in C++ for embedded Runge-Kutta methods (explicit and Rosenbrock for the moment). The idea is to keep the code simple and general so that one can pass their Butcher tableau (of any order) and just run it. I have…
dkaramit
  • 125
  • 7
1
vote
2 answers

Runge–Kutta methods for ODE integration in Python with additional constraints

I have a question on solving second order differential equations using RK4, considering additional constraints on the first derivative. I am doing the example shown here with some modifications θ′′(t) + b θ′(t) + c sin(θ(t)) = 0 The additional…
1
vote
3 answers

Lorenz attractor with Runge-Kutta python

Hello I have to program a python function to solve Lorenz differential equations using Runge-Kutta 2cond grade sigma=10, r=28 and b=8/3 with initial conditions (x,y,z)=(0,1,0) this is the code i wrote, but it throws me an error saying overflow…
1
vote
1 answer

Difficulties with RK4 VBA Function. Function only returns #REF! value

I was wondering if I could get some help finding where I'm going wrong in my function. I've been trying to write a function to use the RK4 method (Runge-Kutta 4) to evaluate an ODE. I've tried changing a few things, but no matter what I do, the…
1
vote
0 answers

ODE SYSTEM OF EQUATION

I'm trying to solve a system of ode's using Runge-kutta, i made a function for RK2(f,h,x0,y0,xfinal) and tried to solve the system shown below with specified IC's. Could someone help fix the code as I get errors and code doesn't work. ode set beta…
Mv2156
  • 27
  • 5
1
vote
3 answers

How to correctly implement forced mass spring system ode solver with a force time dependent variable using scipy.integrate.odeint

I am trying, for each of the 5 cases, to integrate numerically through the odeint function, a spring mass function, the parameter F being variable with time. However, it presents the error: line 244, in odeint int(bool(tfirst))) ValueError:…
1
vote
0 answers

How can i solve the scattering Brillouin equations with runge kutta 4 with python?

actually i'm realizing a project in python and i'm relatively new in this language. I want to solve the brillouin scattering's equations with Runge-Kutta 4 method and make a simulation of the behavior (i attach the document where are the equations…
1
vote
0 answers

4th order Runge-Kutta for infinite square well

The following code works for n = 1 but for higher energy levels the wave function is flipped in the x-axis compared to the expected wave function. Does anyone know why this is? V(x) is set to be 0 for all x and the energies were all correct compared…
rj_011
  • 11
  • 1
1
vote
1 answer

How can I stop my Runge-Kutta2 (Heun) method from exploding?

I am currently trying to write some python code to solve an arbitrary system of first order ODEs, using a general explicit Runge-Kutta method defined by the values alpha, gamma (both vectors of dimension m) and beta (lower triangular matrix of…
1
vote
1 answer

Programming of 4th order Runge-Kutta in advection equation in python

%matplotlib notebook import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation from math import pi # wave speed c = 1 # spatial domain xmin = 0 xmax = 1 #time domain m=500; # num of time steps tmin=0 T = tmin +…
alimuradpasa
  • 135
  • 1
  • 10
1
vote
0 answers

Runge Kutta and PGPLOT

Hi guys when I use this code (makefile not included) I am supposed to be getting two sinusoidal outputs graphed on the same set of axes but for some reason although the output data is accurate the graph is not. In face its not even a smooth curve,…
1
vote
1 answer

How to solve the following question using the provided Runge-Kutta method in python

The question body: A skydiver of mass m in a vertical free fall experiences an aerodynamic drag force F=cy'² ('c times y prime square') where y is measured downward from the start of the fall, and y is a function of time (y' denotes the derivative…