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
Click For Summary
SUMMARY

The discussion centers on the comparison between the Euler method and the Runge-Kutta fourth order method for solving a two-dimensional differential equation, specifically dx/dt = (-y, x). The user initially observed that the Euler scheme appeared to yield more precise results than the Runge-Kutta method. After debugging, the user discovered an error related to an extra time increment in their code, which clarified the discrepancy in performance between the two methods.

PREREQUISITES
  • Understanding of differential equations, particularly two-dimensional systems.
  • Familiarity with numerical methods for solving differential equations, specifically Euler and Runge-Kutta methods.
  • Proficiency in a programming language suitable for implementing numerical algorithms (e.g., Python, MATLAB).
  • Basic knowledge of debugging techniques in coding.
NEXT STEPS
  • Research the implementation details of the Runge-Kutta fourth order method.
  • Explore error analysis in numerical methods to understand precision differences.
  • Learn about adaptive step size methods to improve numerical integration accuracy.
  • Investigate common pitfalls in coding numerical algorithms and debugging strategies.
USEFUL FOR

Mathematicians, engineers, and computer scientists involved in numerical analysis, particularly those working with differential equations and numerical methods for simulations.

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
 

Similar threads

  • · Replies 65 ·
3
Replies
65
Views
9K
  • · Replies 3 ·
Replies
3
Views
7K
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 16 ·
Replies
16
Views
3K
Replies
7
Views
3K
  • · Replies 14 ·
Replies
14
Views
5K