How can I apply Euler's method without the interval component?

In summary: D; you will have 3 values in the third column and then you can use excel's line fitting function to find the best fit line for the log-log plot of the error vs. h, which will give you the slope of the line, which is the required estimate of kappa.
  • #1
kalish1
99
0
I have a problem on which I need to apply Euler's method - EXCEPT that I don't have one of the crucial components. Question and my thoughts below:

**Question:** Consider the initial value problem $\frac{dy}{dt}=\alpha t^{\alpha - 1}, y(0)=0$, where $\alpha > 0$. The true solution is $y(t)=t^{\alpha}$. Use the Euler method to solve the initial value problem for $\alpha = 2.5,1,5,1.1$ with stepsize $h=0.2,0.1,0.05$. Compute the solution errors at the nodes, and determine numerically the convergence orders of the Euler method for these problems.

**My thoughts:** I don't have the "interval" for t! I tried setting the problem up as follows:

$0 \leq t \leq b$, with $N = (b-0)/0.2 = 5b$ for $h=0.2$, but wasn't able to get anything conclusive.

Should I try $b = 1$, so that t is restricted to a range in which it shrinks?

Thanks for any help.
 
Mathematics news on Phys.org
  • #2
kalish said:
I have a problem on which I need to apply Euler's method - EXCEPT that I don't have one of the crucial components. Question and my thoughts below:

**Question:** Consider the initial value problem $\frac{dy}{dt}=\alpha t^{\alpha - 1}, y(0)=0$, where $\alpha > 0$. The true solution is $y(t)=t^{\alpha}$. Use the Euler method to solve the initial value problem for $\alpha = 2.5,1,5,1.1$ with stepsize $h=0.2,0.1,0.05$. Compute the solution errors at the nodes, and determine numerically the convergence orders of the Euler method for these problems.

**My thoughts:** I don't have the "interval" for t! I tried setting the problem up as follows:

$0 \leq t \leq b$, with $N = (b-0)/0.2 = 5b$ for $h=0.2$, but wasn't able to get anything conclusive.

Should I try $b = 1$, so that t is restricted to a range in which it shrinks?

Thanks for any help.

Try \(\displaystyle b=0.2\), then look at the absolute error between the true solution and the computed solutions at \(t=b\) for each step size \(h=0.05, 0.1, 0.2\) and put \(\displaystyle error_{t=b}(h)=Ah^\kappa\) and estimate \(\displaystyle \kappa\) from your data.

(In fact setting \(b\) to any multiple of \(0.2\) will do, it is just a question of how much computation you wish to do, the bigger you make \(b\) the better the estimate of \(\kappa\) should be)
 
Last edited:
  • #3
Hello,

I tried what you said, and I am not getting satisfactory results. For example, take the case presented below:

Information: h=0.05 y(0)=0 alpha=2.5 dy/dt=2.5*t^(1.5) y(t)=t^(1.5) a=0, b=1 N=20 t in [0,1]

i w_i y(t_i) |y(t_i)-w_i|
0 0 0 0
1 0 0.0005590 0.0005590
2 0.00139754 0.00316228 0.00176474
3 0.00535039 0.00871421 0.00336382
4 0.0126122 0.0178885 0.0052763
5 0.0237926 0.03125 0.0074574
6 0.0394176 0.049295 0.0098774
7 0.0599572 0.072472 0.0125148
8 0.08584 0.101193 0.015353
9 0.117463 0.135841 0.018378
10 0.155196 0.176777 0.021581
11 0.199391 0.22434 0.024949
12 0.250377 0.278855 0.028478
13 0.308472 0.34063 0.032158
14 0.373978 0.409963 0.035985
15 0.447185 0.487139 0.039954
16 0.528375 0.572433 0.044058
17 0.617818 0.666112 0.048294
18 0.715776 0.768433 0.052657
19 0.822502 0.879648 0.057146
20 0.938246 1 0.061754

Now, I am using the same h in my (h^k) term, but the error varies, so my k also varies right? In any case, I don't get O(h).

Using Lipschitz continuity and the error bound, I was able to obtain O(1.875h) for this particular case of $\alpha = 2.5, h=0.05, 0 \leq t \leq 1$.

Have I done everything correctly?
 
  • #4
kalish said:
Hello,

I tried what you said, and I am not getting satisfactory results. For example, take the case presented below:

Information: h=0.05 y(0)=0 alpha=2.5 dy/dt=2.5*t^(1.5) y(t)=t^(1.5) a=0, b=1 N=20 t in [0,1]

i w_i y(t_i) |y(t_i)-w_i|
0 0 0 0
1 0 0.0005590 0.0005590
2 0.00139754 0.00316228 0.00176474
3 0.00535039 0.00871421 0.00336382
4 0.0126122 0.0178885 0.0052763
5 0.0237926 0.03125 0.0074574
6 0.0394176 0.049295 0.0098774
7 0.0599572 0.072472 0.0125148
8 0.08584 0.101193 0.015353
9 0.117463 0.135841 0.018378
10 0.155196 0.176777 0.021581
11 0.199391 0.22434 0.024949
12 0.250377 0.278855 0.028478
13 0.308472 0.34063 0.032158
14 0.373978 0.409963 0.035985
15 0.447185 0.487139 0.039954
16 0.528375 0.572433 0.044058
17 0.617818 0.666112 0.048294
18 0.715776 0.768433 0.052657
19 0.822502 0.879648 0.057146
20 0.938246 1 0.061754

Now, I am using the same h in my (h^k) term, but the error varies, so my k also varies right? In any case, I don't get O(h).

Using Lipschitz continuity and the error bound, I was able to obtain O(1.875h) for this particular case of $\alpha = 2.5, h=0.05, 0 \leq t \leq 1$.

Have I done everything correctly?

You cannot estimate \(\kappa\) from one integration as the error term is approximately of the form:
\[error_{t=b}(h)=Ah^{\kappa}\]
(there was a typo in my earlier post)) so one step size is not adequate to estimate \(\kappa\). Now if you do a log plot of the error and step size the gradient of the best line will give the required estimate of \(\kappa\) (and it is close to 1):

\[\ln(error_{t=b}(h))=\kappa \ln(h) + \ln(A)\]

..
 
Last edited:
  • #5
Hi,
Could you help me figure out how to do this in Excel?

"Do a log plot of the error and step size; the slope of the best line will give the required estimate"

I have everything up to this part.
 
  • #6
Does anyone have any ideas?
 
  • #7
kalish said:
Does anyone have any ideas?

Enter the three values of the error in the first column and the corresponding values of h at t=1 (or 0.2) in the second column. Now put the log of the first column in the third and the log of the second column in the fourth. Select the third and fourth column and use the plotting tools to do a scatter plot. When you have the scatter plot select the line and use the tool provided to generate the equation fro the regression line (can't tell you the exact key sequence as I am not at a machine with Excel at present.

.
 
  • #8
zzephod said:
Enter the three values of the error in the first column and the corresponding values of h at t=1 (or 0.2) in the second column. Now put the log of the first column in the third and the log of the second column in the fourth. Select the third and fourth column and use the plotting tools to do a scatter plot. When you have the scatter plot select the line and use the tool provided to generate the equation fro the regression line (can't tell you the exact key sequence as I am not at a machine with Excel at present.

.

Hello,
Everything came out right. Now, I need to do the same problem using the Modified Euler method. However, after I inputted the equations and repeated the process, I am getting the slopes of the best lines to be way off from 1. (They are near 0.5). Is there a reason for this discrepancy?
 
  • #9
kalish said:
Hello,
Everything came out right. Now, I need to do the same problem using the Modified Euler method. However, after I inputted the equations and repeated the process, I am getting the slopes of the best lines to be way off from 1. (They are near 0.5). Is there a reason for this discrepancy?

You are doing the plot the wrong way around (or rather \( \kappa \) s the reciprocal of the slope with the equation this way around) the gradient is close to 2, which is what it should be as modified Euler is second order.

.
 
Last edited:

FAQ: How can I apply Euler's method without the interval component?

What is Euler's method?

Euler's method is a numerical method used for approximating the solutions of first-order differential equations. It is based on the concept of continuously iterating a differential equation to find a more accurate solution.

How does Euler's method work?

Euler's method works by taking a small step from a known point on the curve of a differential equation and using the slope at that point to approximate the next point on the curve. This process is repeated until the desired accuracy is achieved.

What is the difference between Euler's method and other numerical methods?

Euler's method is a simple and straightforward numerical method that only requires knowledge of the initial value and the derivative at that point. Other methods, such as the Runge-Kutta method, use multiple points and higher-order derivatives to achieve a more accurate approximation.

Can Euler's method be applied to any differential equation?

No, Euler's method is only applicable to first-order differential equations that can be written in the form of dy/dx = f(x,y). It is not suitable for higher-order differential equations or those with complex boundary conditions.

What are the limitations of Euler's method?

Euler's method can produce inaccurate results if the step size is too large or if the function is highly nonlinear. It is also prone to numerical errors and can only provide an approximation, not an exact solution.

Similar threads

Replies
1
Views
1K
Replies
7
Views
3K
Replies
38
Views
11K
Replies
1
Views
2K
Replies
1
Views
1K
Replies
1
Views
1K
Replies
1
Views
1K
Back
Top