Understanding Euler's Method: Solving a Numerical Approximation Problem

In summary, using euler's method with step size D=1 [delta was used in the text but I can't seem to get a "Delta" symbol working], estimate x(1) numerically ... then repeat using D=(10^-n) for n=1,2,3...
  • #1
anb
3
0
Hi all. I've been having a bit of trouble just understanding Euler's method, which I need to know (and probably should have known for a while now) for a question on an assignment. I'm going to provide an example with confusing wording (at least to me) and show what I've done to try to understand it. I think I get it but I want to be absolutely sure.

Homework Statement



So for the question we have (dx/dt) = f(x) = -x with initial condition x(0) = 1. The first part asks us to give an exact solution to x(1). I believe the solution is (e^-1) and I'm not having trouble with this part (but if that's incorrect then maybe that's my problem - I reasoned that you could just separate variables and integrate both sides, giving -lnx=t+K for some constant K. x=1 at t=0 so K=0 since ln1=0. So then if t=1 and K=0, lnx=-1 which means x=e^-1).

The second part says "using Euler's method with step size D=1 [delta was used in the text but I can't seem to get a "Delta" symbol working], estimate x(1) numerically ... then repeat using D=(10^-n) for n=1,2,3..."

Homework Equations


The Attempt at a Solution



Now here's what I did. The text tells us that to approximate solutions with euler's method we use the recursion xn+1=xn+f(xn)*D. So I take x0=1 since x(0)=1 is the initial condition. Therefore f(x0)=-1 since f(x)=-x, and with D=t that gives us the approximation x1=0 (because this is such a poor approximation I assume I may have gone wrong here, ie maybe I just don't understand which values to plug where).

Now when it asks us to repeat with different step sizes D=(10^-n), I'm not sure if it means that for approximating xn+1 we should use D=(10^-n), or if the text is asking us to repeat using that step size for the approximation of x1. The latter doesn't really make sense to me, because that would lead to an even worse approximation for all n>0. My problem though is that if I repeat the incursion for n>0, I'm pretty sure I get
xn+1=0 for all n>1 since the approximation x1=0, so x2=x1+f(x1)*D=0 no matter what D is. I realize that this could still be the intended way of solving the problem, it just doesn't seem very nice because the actual step size doesn't matter and I'm used to having to use every part of a problem to solve it (and in this case the step size seems like a red herring).

Keep in mind I've never worked with euler's method before (shock), and I may just be over-thinking the problem
 
Physics news on Phys.org
  • #2
It is not strange that you get a bad answer when you only do one step.

What you are supposed to do next is do the whole thing over but this time having a step size of [tex] 10^{-1} [/tex].
This means that you need to step 10 times to get to [tex] x = 1[/tex]. This should give you a better approximation. Remember in every step you need to update both the x-value and the function value.

With n = 2 you do a hundred steps. If you know any programming you can automate this process (I don't think your teacher wants you to do it manually a hundred times).
 
  • #3
Inferior89 said:
It is not strange that you get a bad answer when you only do one step.

What you are supposed to do next is do the whole thing over but this time having a step size of [tex] 10^{-1} [/tex].
This means that you need to step 10 times to get to [tex] x = 1[/tex]. This should give you a better approximation. Remember in every step you need to update both the x-value and the function value.

With n = 2 you do a hundred steps. If you know any programming you can automate this process (I don't think your teacher wants you to do it manually a hundred times).

Oh, I think I understand now - so for a step size of 1/10 I should first get x1=9/10, which means at the next step I compute 9/10 + (1/10)f(9/10), and so on with the result of each step, ten times? (So for the step after I'd do 81/100 + (1/10)f(81/100), etc.?) After trying this out, I am getting a much better approximation of e^-1 after the tenth step.
 

1. What is Euler's method and how does it work?

Euler's method is a numerical approximation technique used to solve differential equations. It works by breaking down a continuous function into small intervals, and using the slope of the function at each interval to estimate the value of the function at the next interval.

2. When should Euler's method be used?

Euler's method should be used when the differential equation cannot be solved analytically, or when the analytical solution is too complex to compute. It is also useful for solving differential equations that represent real-world problems, where the exact solution is not necessary.

3. What are the limitations of Euler's method?

Euler's method has several limitations. It can only provide an approximation of the solution, and the accuracy of the approximation depends on the size of the intervals used. It also tends to accumulate error over time, especially for functions with high curvature. Additionally, it may not work well for solving stiff differential equations.

4. How can the accuracy of Euler's method be improved?

The accuracy of Euler's method can be improved by using smaller intervals, also known as decreasing the step size. This reduces the error accumulated over time. Other methods, such as Runge-Kutta methods, can also be used to improve the accuracy of the approximation.

5. Can Euler's method be used for all types of differential equations?

No, Euler's method is most suitable for solving first-order ordinary differential equations. It can also be used for higher-order differential equations by converting them into a system of first-order equations. However, it may not be the most efficient or accurate method for solving some types of differential equations, such as stiff equations or those with discontinuous solutions.

Similar threads

  • Calculus and Beyond Homework Help
Replies
2
Views
102
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Calculus and Beyond Homework Help
Replies
2
Views
423
Replies
7
Views
2K
Replies
1
Views
920
  • Calculus and Beyond Homework Help
Replies
1
Views
981
  • Calculus and Beyond Homework Help
Replies
5
Views
535
  • Calculus and Beyond Homework Help
Replies
18
Views
1K
  • Calculus and Beyond Homework Help
Replies
1
Views
443
  • Calculus and Beyond Homework Help
Replies
1
Views
286
Back
Top