Welcome to our community

Be a part of something great, join today!

Euler's method, no interval

kalish

Member
Oct 7, 2013
99
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.
 

zzephod

Well-known member
Feb 3, 2013
134
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:

kalish

Member
Oct 7, 2013
99
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?
 

zzephod

Well-known member
Feb 3, 2013
134
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:

kalish

Member
Oct 7, 2013
99
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.
 

kalish

Member
Oct 7, 2013
99
Does anyone have any ideas?
 

zzephod

Well-known member
Feb 3, 2013
134
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.

.
 

kalish

Member
Oct 7, 2013
99
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?
 

zzephod

Well-known member
Feb 3, 2013
134
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: