Code for verlet frog leap method.

  • Thread starter Thread starter MathematicalPhysicist
  • Start date Start date
  • Tags Tags
    Code Method
AI Thread Summary
The discussion centers on finding C code for the Verlet leapfrog method, a numerical integration technique used to advance a system of particles based on their acceleration, velocities, and displacements. Participants clarify that the Verlet leapfrog method is also known as the leapfrog method, which may yield better search results. The method involves updating velocities and positions at staggered time intervals, with a typical sequence of updates every half timestep. A useful resource is provided, linking to pseudocode and additional information. Higher-order versions of the leapfrog method, such as the Yoshida integrator, are mentioned as alternatives. Additionally, there is a reference to the staggered leapfrog method found in "Numerical Recipes in C," suggesting that users could look for user-supplied Matlab codes to translate into C if needed.
MathematicalPhysicist
Science Advisor
Gold Member
Messages
4,662
Reaction score
372
im searching for a C code for verlet leap method, i.e a one the advances the system of particles with accleration,velocities,displacements.

anyone knows where may i find such a code?

thanks in advance.
 
Technology news on Phys.org
too lazy to code yourself?
 
neurocomp2003 said:
too lazy to code yourself?

Now, now, take it easy. I'd love to help, but I have no idea of what a verlet leap method is. Anyone? :blushing:
 
its known also plainly as the leapfrog method which gives more hits for a search than verlet.

Basically you have some timestep dt...each halfstep you update v and each fullstep you update x. (you might also beable to update v each fullstep).

t=0 => initial cfg
t+0.5dt=> update v
t+1.0dt=> update x
t+1.5dt=> update v
etc.
 
Useful link, with both the pseudocode and additional info:

http://artcompsci.org/kali/vol/two_body_problem_2/ch01.html

[edit]: More general versions ('higher order leapfrog') are also available. fourth-, sixth- and eighth-order leapfrog methods are available online, all of which are (naturally) symplectic. Do a search for 'Yoshida integrator', that should turn up some useful results.
 
Last edited by a moderator:
neurocomp2003 said:
too lazy to code yourself?

i wish that were the case.
 
didn't find anything there about leap frog method.
 
Try looking at the user supplied codes for Matlab and then translate the code into C if someone has done it.
 
  • #10
The staggered leapfrog method is described in Numerical Recipes in C in chapter 19 (Partial Differential Equations) section 1 (Flux-Conservative Initial Value Problems) on the bottom half of page 842: http://www.nrbook.com/a/bookcpdf/c19-1.pdf
 

Similar threads

Replies
2
Views
3K
Replies
2
Views
4K
Replies
3
Views
2K
Replies
1
Views
3K
Replies
10
Views
3K
Replies
1
Views
2K
Replies
6
Views
2K
Back
Top