Runge-Kutta vs Euler: Solving Two-Dimensional Differential Equation

  • Context: Undergrad 
  • Thread starter Thread starter mrsvan
  • Start date Start date
  • Tags Tags
    Euler Runge-kutta
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 7K views
mrsvan
Messages
2
Reaction score
0
Hi, I don't know if this is the right forum to address, but I will try nevertheless
Im solving a simple two-dimensional differential equation:

dx/dt = (-y,x)

which will give a circle when integrating over time.

Now, the problem is that the simple euler scheme seems to be a lot more precise than the runge-kutta fourth order method. I've spend two whole days trying to debug my code and I feel stuck. so, are there some special cases where rk is worse than euler -- or is there no other explanation than I have made a mistake somewhere (it's four lines of code and my supervisors have had a look without the error popping up.)
 
Physics news on Phys.org
great monday... just after complaining in here i found that I've messed an extra time-increment in somewhere in the code :p sorry for the inconvenience