Euler's Method is a method for numerically approximating values of a function, given its derivative (dy/dx) and a point (x, y) to begin with. It is especially useful when the derivative expression contains y's that may be otherwise difficult to resolve with integration.

Begin by choosing dx; the smaller the dx, the more accurate the result, but the more numerous the steps. The initial x and y are the coordinates of the given point.

At each step, calculate dy/dx with the current x and y, multiply by dx, and add this to the current y to find the next y-value; the next x-value is the current x plus dx. Iterate as often as necessary until you reach the x for which you wish to calculate the y-value.

(this looked like it could use a more detailed explanation of why/how it works... and it was on the CRT's node list)

Euler's (oiler, not you-ler) Method is a way to approximate the value of a function given its derivative and a point on the function; simply put, it lamely helps solve differential equations. It's usually used for differential equations that are very difficult to integrate, or for people that are really really lazy.

To see how this works, first consider what a derivative is. (If you don't know what a derivative is, go read up on basic calculus.) The derivative at any point (x, f(x)) is the slope of the tangent line at that point, or essentially the slope of the graph at that point. Doesn't it make sense that near the point, the tangent line is very close to the actual function? Of course it does. Try graphing a function and its tangent at some point on a graphing calculator and zooming way in if you don't believe me. Thus, we can use the derivative at a point to find the values of points nearby.

Euler's Method is just an extension of this. By hopping from x value to x value along the graph in small increments, you can trace an approximation of the original function all the way to the point you're trying to find. This actually approximates fairly well for small distances.

How to Do It

Unknown function: f(x) or f(x, y)
Differential equation: dy/dx = F(x, y)
Given point: (x0, y0)

First, decide on a small step value and call it dx. 0.1 is a good generic value, but you can use a higher or lower number depending on how much accuracy you want, how complex the function is, how far away your target value is, and how lazy you are. Now, proceed along the x-axis one dx at a time. The first x-value you'll step to, then, will be x0 + dx. To find the y-value, refer to the following horrid ASCII diagram:

                (x1, y1)
                + -
               /| |
              / | |
             /  | |
            /   | dy
           /    | |
          /     | |
(x0, y0) +------+ -


Now, we want to find dy and add it to our first y-value to find the next one...

dy/dx = dy/dx
dy = dy/dx * dx

Ah, obviously, but how does this help us? Well, remember that dy/dx = F(x, y). So dy = F(x, y) * dx and y1 = y0 + F(x0, y0) dx.

Now we have a second point! Repeat this process one point at a time until you find what you're looking for. Also note that you can subtract instead of add if you're going the other way.

To summarize:
xn = xn - 1 + dx
yn = yn - 1 + F(xn, yn) dx

There is also something called the Improved Euler's Method, which is nearly identical EXCEPT that after estimating the next y-value, the average between the slope at the old point and the slope of the new point is used and y is calculated again. Yes, it sounds stupid in words. Do this:
zn = yn - 1 + F(xn - 1, yn - 1) dx
yn = yn - 1 + ( ( F(xn - 1, yn - 1) + F(xn, yn) ) / 2 ) dx
It's more work, but the results are much more accurate.

Of course, if you're lazy as all hell like me, you'll do one or two steps before getting really annoyed and busting out the TI-89 or just integrating the stupid thing. Fear not! It's easy to write a program to do this for you, and math teachers are suckers for calculator programs as long as they aren't games. I can't write out the code for every version of TI-BASIC, but if you know what you're doing it should be easy to convert this code (not in any particular language, it's like the bastard child of Perl/C++) to any language you want:

// This assumes f(x, y) is your differential function, x and y are the coordinates of the first point,
// s is the step size, and n is the number of steps to make.
// Input/calculate/assign these however you want.
for (i = 1, i <= n, i++) {
    newx = x + s;
    newy = y + f(x, y) * s;
    // Uncomment this line to use the Improved Method:
    // newy = y + ((f(x, y) + f(newx, newy)) / 2) * s;
    print "Step " + i + ": x = " + newx + ", y = " + newy + ", dy = " + ((newy - y) / s) + "\n";
    x = newx; y = newy;

If I had a TI-83 I would've written it in 83's BASIC... but I don't, so I can't, so I didn't and I won't. Sorry. If you don't know anything about TI-BASIC but still want to port this pathetic little program, you should either RTFM or locate the stereotypical geek in your math class..

Log in or register to write something here or to contact authors.