Thursday, February 7, 2013

Excel did my Math Homework

We started the week in differential equations talking about Euler’s method of approximating the value of a function given the derivative and an initial condition.  Anyone who has suffered through been fortunate enough to learn about Euler’s approximations knows that it’s a pain in the neck, and inaccurate, to use Euler’s method to approximate the function once you get around 0.00001 units or so away from your starting point.  (It may be slightly more accurate than that, but math books like to have students do problems like “using a change in x of 0.01 and starting from 0, use Euler’s method to approximate f(x) at x=1.”  As you’ll see in a moment, not fun.)

So Euler’s method says that given y' = f(x,y), yn+1 = y+ (xn+1-xn) * f(xn,yn).  This basically assumes that the slope at the left-hand endpoint of the interval is the slope over the whole interval, and breaks up a function into linear pieces.

To do one of these problems by hand, you start with the given point and calculate the slope at that point.  Since the slope is the change in y over change in x, the slope multiplied by the change in x equals the change in y.  The change in y can then be added to the original value of y to get the new value of y.  The tediousness of the process arises because the smaller the change in x is, the more accurate the approximation.  But the smaller the change in x is, the more calculations it takes to get any significant movement along the graph, so after finding the new y, there should be sentences that say, “And repeat.  A lot.”

I was not in the mood to sit around punching seven hundred numbers into my calculator, so I figured I’d have Excel do the calculations for me.


Homework, done. #WhatILearnedInChemE

No comments:

Post a Comment