• Support PF! Buy your school textbooks, materials and every day products via PF Here!

Euler's method

Consider the initial value problem

[tex]y^{\prime} = \frac{3t^2}{3y^2 - 4} \mbox{,} \qquad y(1) = 0\mbox{.}[/tex]

(a) Use Euler's method with [tex]h=0.1[/tex] to obtain approximate values of the solution at [tex]t=1.2\mbox{, }1.4\mbox{, }1.6\mbox{, and } 1.8[/tex].

(b) Repeat part (a) with [tex]h=0.05[/tex].

(c) Compare the results of parts (a) and (b). Note that they are reasonably close for [tex]t=1.2\mbox{, }1.4\mbox{, and }1.6[/tex], but are quite different for [tex]t=1.8[/tex]. Also note (from the differential equation) that the line tangent to the solution is parallel to the y-axis when [tex]y=\pm 2/\sqrt{3}\approx \pm 1.155[/tex]. Explain how this might cause such a difference in the calculated values.

My work: (PARTS A & B ARE OK)

(a)

Approximate values of the solution, which were found using the Euler method, follow below:

[tex]\begin{equation*}\begin{array}{|c|r|} \hline \multicolumn{1}{|c|}{t} & \multicolumn{1}{c|}{h=0.1} \\ \hline 1.2 & -0.166134 \\ 1.4 & -0.410872 \\ 1.6 & -0.804660 \\ 1.8 & 4.15867 \\ \hline \end{array} \end{equation*}[/tex]

(b)

Approximate values of the solution, which were found using the Euler method, follow below:

[tex]\begin{equation*} \begin{array}{|c|r|r|} \hline \multicolumn{1}{|c|}{t} & \multicolumn{1}{c|}{h=0.1} & \multicolumn{1}{c|}{h=0.05} \\ \hline 1.2 & -0.166134 & -0.174652 \\ 1.4 & -0.410872 & -0.434238 \\ 1.6 & -0.804660 & -0.889140 \\ 1.8 & 4.15867 & -3.09810 \\ \hline \end{array} \end{equation*}[/tex]

(c)

I've plotted the direction field with the solution. You can find it at: http://myplot.cjb.net

The graph shows that the line tangent to the solution is parallel to the y-axis when [tex]y=\pm 2/\sqrt{3}\approx \pm 1.155[/tex]. That's when the denominator of the fraction in the given differential equation equals zero.

My approximate solution (found with the aid of mathematica's NDSolve) is valid for [tex]t\leq 1.5978094538975247[/tex]. So, it seems to me that the values found should not be even taken into consideration from that point on. However, if I were to consider values beyond [tex]t = 1.5978094538975247[/tex], I'd say that the significant difference in step size may lead each particular approximation to tangent lines with completely different slopes, which ultimately gives those values. I'm not sure. :confused:

Any help is highly appreciated.
 

saltydog

Science Advisor
Homework Helper
1,582
2
Thiago, Mathematica's nice huh? You know when you solve it directly, you get an implicit function of y in terms of t. Try this code in Mathematica to see what it looks like and note the problem beyond the vertical slope:

Code:
<<Graphics`ImplicitPlot`

ImplicitPlot[y^3-4y== t^3-1,{t,-3,3}]
You should get the plot below.
 

Attachments

You bet, saltydog! Mathematica is great. Well, thanks for the code. I didn't know how to do that. I've got the same plot here, but then I joined that with the direction field. You can view it at: http://myplot.cjb.net

Anyway, here's what I think I should have for part (c):

In part (a), the closest value to [tex]y=-2/\sqrt{3}[/tex] is [tex]y\left( 1.7 \right)[/tex], which has a large positive slope (check out the graph). As a result, it follows (Euler method) that [tex]y\left( 1.8 \right)[/tex] is positive and reasonably close to the true value ([tex]\approx 2.445[/tex]).

In part (b), the closest value to [tex]y=-2/\sqrt{3}[/tex] is [tex]y\left( 1.65 \right)[/tex], which has a large negative slope (check out the graph). As a result, it follows (Euler method) that [tex]y\left( 1.7 \right)[/tex] is negative.

Is that it? Thanks again. :smile:
 

saltydog

Science Advisor
Homework Helper
1,582
2
thiago_j said:
As a result, it follows (Euler method) that [tex]y\left( 1.8 \right)[/tex] is positive and reasonably close to the true value ([tex]\approx 2.445[/tex]).
Took some time for me to analyze it too Thiago. You're probably done but this is my take:

I found it a tough problem to analyze but very interesting and illustrates how numerical methods are sometimes limited. I agree with your analysis except for one thing: your assumption above connecting the behavior to the "true value". I don't think they're related in any way. It just so happens that y(1.7)=-1.178, was below the critical line [itex]-2/\sqrt{3}[/itex] with slope (53.366) and so just happen to push the next value up to the point (1.8, 4.159).

Think I might spend a little more time on it in Mathematica.
 
You're right about that. "Reasonably close" doesn't exactly fit the description of the difference between those numbers. But, other than that, the solution of part (c) seems to be alright. Thank you
 
Last edited:

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top