Wednesday, March 19, 2008

The Edmonton Eulers Method

Hey everyone, it's MrSiwWy here as the scribe for March 18's class on Euler's method. I know I started this scribe post pretty late, but I just got home from the fashion show at school, which was definitely an enjoyable occasion. I really found this topic quite interesting, so I'll very much enjoy explaining his method as intricately as possible. Now with classes only every second day, I didn't think scribe duties would remain so frequent, though the class is indeed quite minuscule in comparison to the class size first semester. Oh yes, and before I begin, I think i must note that all explanations will be accompanied by an example furthering my explanation in a different text colour. Text in black will be initial explanations, while text in green will pertain to explanations using an example for the first part of the post and text in blue will pertain to explanations using an example for the second part of the post. Hope it works out well. Enjoy!


I can't remember exactly how class started, though I do recall it initiated with the usual abstract chatter and various technological utility exposures by Mr. K. But what I do remember, is beginning the actual lesson with a very fundamentally elegant and quite remarkable equation; Euler's identity.

Though we didn't go in depth into what Euler's identity is and how it was formulated, but we did vaguely discuss the implications of the identity. The sheer elegance of the equation derives from the fact that it contains and also intertwines the destiny of five of the most important constants in mathematics: 0, 1, (pi), i, and e. Euler's identity is as follows:

Now we transitioned into the basis of the day's topic: Euler's method. I think it's quite a useful technique, and is a very innovative technique with easy implementation (at our level at least). We started off with a demonstration of Euler's method without any formal introduction quite yet. This demonstration can be found here. If you follow the link, it might ease the subsequent explanations tremendously.

- First off, imagine that you are given an initial value problem. Recall that an initial value problem is a problem in which you are given a differential equation to solve as usual, but you are also given a point that exists on the parent function/solution to the differential equation.

*In this case, as used by the aforementioned demonstration, take the differential equation to be y'(t) = 1 - t + 4y(t) and the initial point to be y(0) = 1. This means that at t = 0, y(t) = 1. Following the above link will drastically clarify this example. Also, take note that we know the point (0,1) on the differential equation solution, and therefore have an exact solution and not just a general one. A general solution only represents the family of functions that could fit the solution for the differential equation. An exact one means that it's only specific function, and not a whole family.

- Now, there is an important idea that I must stress in order for Euler's method to be utilized easily, so pay attention in case you missed it in class. We must find a way to get another point on the parent function, which can be easily determined by plugging in the initial value/point into the differential equation to solve for the slope of the line tangent to the function at that point. Using this slope we can use our classic definition of slope to yield the next point that exists on the function y(t) given a certain step.

*The point (0,1) is known to lie on the function y(t), but how are we possibly going to get another point on this function? Well, as I stated earlier, since we know the differential equation, we can plug in the point (0,1) into the differential equation (which is y'(t) = 1 - t + 4y(t) in this case) and determine the slope of the line tangent to the function at that point. This is because the differential equation will solve for y'(t), which is the derivative of y(t) or rather the instantaneous rate of change of y(t) at a given t. This is particularly useful since using our rather classic definition of "slope" (rise over run) will yield our next point. By plugging in the initial point into the differential equation as follows, we can determine the required slope:

y'(0) = 1 - (0) + 4(1)
y'(0) = 5

Using this slope with the "old-school" rise over run definition of slope, we can easily determine the next point. But be careful, you must pay careful attention to the steps or the scale of each axis to correctly apply this definition. Since the steps we will be using in this case are 0.1, that means that instead of the function increasing upwards by 5 and increasing rightwards by 1, the function will increase upwards by 0.5 as it travels rightwards by 0.1. This means that the next point will be (0.1, 1.5). Using the next button on the demonstration page will automatically graph the next point on the function.

- Now that we have two points on the graph, we can easily repeat the above process to determine any subsequent points and find an accurate portrayal of the solution. The only problem is that you must use a sufficient amount of steps by decreasing the amount of change along the x-axis (or in this case t) so that each point will be closer to each other and each subsequent derivative will be more accurate than with little points. I advise using this website or this website to help grasp this concept. Review one of these sites to further your understanding of what I have just said. Also, concerning this idea, I tend to think of Euler's method as being quite similar to how an integral works. In an integral, you must let the dx values (or dt) get as close to 0 as possible, so as to increase how accurate the solution truly is or how well the integral fits the actual shape of the function. This is exactly how Euler's method works.

*Each time that you press the next button on the above demonstration, the graph will further the use of Euler's method and graph the next point on the parent function, thereby creating an approximate graph of said function. But notice how choppy each segment looks, even though as a calculus student(and others =p) you should recognize the function to be curved.

Once we were introduced to Euler's method using a bevy of demonstrations and tools to ease the idea of his method to us, we were asked to apply what we had just learned to a problem. This can be seen on the following slide:

In the above slide, all that we really did was find a way (basically on our own) to efficiently repeat the process I detailed above. Though there were some alterations in this problem.

*Basically, when you were given the initial point, you could plug the point into the differential equation (which is y' = y - x this time) to find the derivative of the function at that point. This derivative will be m, or the slope of the tangent line at that point, which can be used by rearranging the m = Δy/Δx equation into Δy = m * Δx. Since m has just been calculated, and Δx (which is the step as I mentioned above) is given in the question as 0.25. Calculating Δy will give us the change in y from the first point to the next point given a certain step, which means we'll know the next points x-coordinate (the first point x-coordinate plus the step) and y-coordinate (the first point's y-coordinate plus the Δy calculated). Thus, this "next" point will be our "initial point" in the next part of the solution. If you use the above slide to help with understanding this idea, then each row will be one iteration of determining the solution to the differential equation. An iteration means a complete round of doing something, such as the process that is being repeated within a loop (which can be taken as the process I detailed above in the first detailed section of this scribe post).

But how can we make this process simpler and reduce the irksomeness of the entire process, especially for cases with a lot more repetitions? One way that we worked out during class involved using the store function in our calculators. This method can actually have several approaches, but basically you can utilize your calculator's store functions in many ways to achieve the same thing. Here's basically what you do:

- Store the initial y value into any variable in your calculator, say A.

- Input this variable into the differential equation on your calculator, and multiply this new expression by the step, and finally add A to this whole thing and store the new answer back into A. It might be hard at first to type this all in within one shot, but it is doable if you do it enough. Below is an example of how it should look in your calculator using the above question.

*Applying this step to the slide above, here's what it would look like in your calculator:
(((A - 0)0.25) + A) -> A

- Simply repeat this line using the [2nd] then [enter] function in your calculator, each time changing the x value according to how the point has changed.

*Again applying this step to the slide above, here's what the next line would look like:
(((A - 0.25)0.25) + A) -> A

Using this method yielded the answers shown in the above slide, which could be taken as solved since the last point on the interval asked for (which was [0,1]) was determined, the question was answered. Though, Mr. K wrote down the exact answer to the problem at the bottom of the slide, which wasn't that close to the answer we arrived at.

So then we tried using more segments to approximate a solution that is much closer than achieved above. We did this by using our new found method of numerically solving initial value problems with Euler's method, we attempted another problem. Though it may look quite empty, all of the work was quickly repeated on our calculators using a method roughly equivalent to the one above, and we all arrived at the same answers as shown in the following slide. I suggest trying it out on your own for some practice. (note: The question is basically the exact same as the first, but it uses far more segments and a much smaller step).

Just before class ended, Mr. K distributed the "EULER" calculator program for us to use to quickly solve problems involving Euler's method.

I will post the algorithms and full code for the program here when I get the full version again, since someone accidentally erased a line in the program and I can't remember what that line was.

Okay, that's all for my scribe for now. I still have some stuff to edit, but it's getting pretty late now and I don't want to be late for Chemistry again tomorrow (I bet people in Chem would doubt that). Anyway, the next scribe will be:
Well good night everyone, see you all in class tomorrow! Please just talk to me or comment if there are any questions, complaints, anxieties, confusions, etc. =p Good bye all!

1 comment:

Anonymous said...; You saved my day again.