[Math] Using Euler’s method and Taylor polynomial to solve differential equation

ordinary differential equationssolution-verification

Consider the initial value problem

$dy/dx=x+y^2$

with $y(0)=1$

a) Use Euler's Method with step-length $h=0.1$ to find an approximation to $y(0.3)$.

HINT 1: :Numerical methods.

HINT 2: Differential equations videos.

b) Let $P2(x)$ denote the second order Taylor polynomial for the solution of the initial value problem $y(x)$ at $x=0$. Find $P2(0.3)$. HINT: Differentiate the differential equation implicitly to find $y′′$.

I just want to know if I've done it correctly.

$y′(0)=0+1^2=1$

$y′′(0)=1+2⋅1⋅1=3$

y(0.3) by Euler method:

$y1=y0+hf(x0,y0)=1+0.1(0⋅1^2)=1$

$y2=y1+hf(x1,y1)=1+0.1(0.1⋅1^2)=1.01$

$y3=y2+hf(x2,y2)=1.01+0.1(0.2⋅1.01^2)=1.030402$

Inserting into Taylor formula:
$P2(0.3)=1+1\cdot (0.3-0)+\frac{3\cdot (0.3-0)^2}{2!}=1.435$

Is this correct? Shouldn't the result from $P2(0.3)$ be closer to that of the Euler method?

Best Answer

Given:

$$\tag 1 \dfrac{dy}{dx}=x+y^2, y(0) = 1, h = 0.1$$

For $(1)$, using Euler's Method we have:

  • $y_0 = \alpha$
  • $y_{i+1} = y_i + hf(x_i,y_i) = y_i + 0.1(x_i + y_i^2)$

Thus, the iterates are:

  • $y_0 = 1$
  • $y1= y_0 + 0.1(x_0 + y_0^2) = 1 + 0.1(0 + 1^2) = 1.1$
  • $y2= y_1 + 0.1(x_1 + y_1^2) = 1.1 + 0.1(.1 + 1⋅1^2) = 1.231$
  • $y3= y_2 + 0.1(x_2 + y_2^2) = 1.231 + 0.1(0.2+ 1.231^2) = 1.40254$

Next, you need to read what is being asked for in the Taylor Polynomial approach and rework that. This is a different approach than the Euler approach.

They provide a hint for this, implicitly differentiate the DEQ to find $y''$. Implicitly differentiating $(1)$ yields:

$$y'' = 1 + 2 y y' = 1 + 2 y (x+y^2) = 1 + 2 x y + 2 y^3$$

Hopefully, you can take it from here.

Related Question