Euler's Method for Systems

Euler's method for a system of two equations approximates the solution of an initial value problem of the form

x' = f(t,x,y), y' = g(t,x,y),  x(t_0) = x_0, y(t_0) = y_0.

In the applet below, t_0 = 0. Enter f(t,x,y), g(t,x,y), x_0, y_0, and b, where [0, b] is the t-interval over which you want to approximate. Also enter n, the number of subintervals of [0, b] you want to use. (Then h = b/n is the step size.) When entering f(t,x,y) and g(t,x,y), you can use +, -, *, /, ^, (), sin(), cos(), tan(), ln(), log(), asin(), acos(), atan(), pi, e. Take care to remember the * in all multiplications and avoid discontinuities. Then press the "Enter" button. If n > 10, press the "Run" button to get the trajectory traced out by Euler's method. If n < = 10, press the "Step" button repeatedly to get the trajectory traced out by Euler's method one step at a time. In addition to the trajectory giving (x,y) as a function of t, you should see x as a function of t traced out in gray, y as a function of t traced out in purple, and the phase plane relating x and y traced out in green.



This applet uses a slightly modified version of the expression parser expr written by Darius Bacon.

source code

arrowBack to the Protas home page