Skip to main content

All Questions

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
1 vote
1 answer
584 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
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
0 votes
0 answers
2k views

Solving nonlinear pendulum using Runge-Kutta 4 for smaller steps

I am trying to solve nonlinear pendulum using 4th order Runge-Kutta method for limits between a=0.0 to b=110 seconds and simulated the results to observe the pendulum movement. But when I increase the ...
147875's user avatar
  • 276
2 votes
1 answer
915 views

Runge-Kutta fourth order method. Integrating backwards

I am using a Runge-Kutta fourth order method to solve numerically the usual equation of motion of a background scalar field in curved spacetime with a quartic potential: $\phi^{''}=-3\left(1+\frac{H^{...
user avatar
2 votes
1 answer
603 views

Langevin equation in 4th order Runge-Kutta

I'm trying to figure out how to translate a piece of code from Velocity Verlet to Runge-Kutta, while treating the time step dependence of the thermal noise correctly. The Langevin equation for my ...
storluffarn's user avatar
1 vote
1 answer
467 views

How to obtain and form a 1st order differential equation for leapfrog integration from second order one in this example of coulomb drag

I am currently doing a computational physics homework which asked us to use leapfrog to give the relations between timevelocities and time-distance of these two objects. The full question is as ...
Programmer's user avatar
5 votes
1 answer
403 views

How can I apply Euler's Method to predict a point in time rotating around multiple axis'

I am xposting this from my original stackoverflow question where I was presented with a coding challenge that I have been able to narrow down extensively and I think it lies with Euler's Method. Here'...
Chris's user avatar
  • 51
1 vote
0 answers
3k views

Using RK2 Method to solve the simple harmonic oscillator of a horizontal mass on a spring (1D)

Being new to numerical analysis techniques, in particular RK2, I decided the best way to jump in is by using python to solve the well known mass-spring oscillator using RK2 techniques. My problem is ...
kuantumbro's user avatar
1 vote
1 answer
625 views

Higher-order Verlet integration

I'm using a simple version of Verlet integration for a particle–particle interaction system with collisions. At the end of each iteration, I integrate like this: ...
huseyin tugrul buyukisik's user avatar
2 votes
1 answer
66 views

Can 3rd order TVD admit perfect shift for Upwind 1D Advection equation?

I recently coded a 1 stage and 3 stage optimal TVD-RK explicit scheme using eqn 3.3 here http://www.ams.org/journals/mcom/1998-67-221/S0025-5718-98-00913-2/ on the equation Ux+Uy=0, where x and y ...
Ayush Agrawal's user avatar
1 vote
1 answer
434 views

Numerical Free Fall Analysis with RK4

I am trying to calculate real speed and time in free fall of a body. I wrote a code in Fortran and I am trying to improve it by using RK4 method x=time y=total free fall Purple line using: ...
Eray Xx's user avatar
  • 113
16 votes
1 answer
3k views

Why is leapfrog integration symplectic and RK4 not, if the latter is more accurate?

In a system where energy theoretically should be conserved, the most accurate simulation would conserve energy (as well as giving accurate positions, velocities and etc). RK4 is more accurate than ...
userManyNumbers's user avatar
2 votes
1 answer
1k views

Object falling with air resistance using Runge-Kutta

I am not very familiar with differential equations, nor physics in general. I am trying to program an object falling with air resistance with the use of a numerical algorithm called Runge-Kutta. The ...
David Lund's user avatar