Euler-Cromer works as well as RK4 for spring-mass system


jarage
03-09-2007, 12:11 PM
I have two algorithms for doing spring-mass simulations. The spring mass obeys these equations:

x(0) = 0
v(0) = 1
a = -bv -kx

Whenever I do the simulation, however, the Euler-Cromer is able to run in less time. My error constraints are:

1) (amplitude_of_oscillation)/(desired_amplitude_of_oscillation)
2) (frequency_of_simulation)/(desired_frequency_of_simulation)

Everything I've been told would indicate that the RK4 would work best. Am I doing it correctly? Is there a way I can predict what my error will be?