Using Euler's method and Taylor polynomial to solve differential equation 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?
 A: 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.
A: Solving ODEs numerically is a vast subject with Euler's method being the easiest way of doing so.
The different methods come up with different properties and accuracy. We normally find the accuracy of a solution as local truncation error (LTE) which we find by mathematically writing down what the computer does.
Euler's method :
$$y_{n+1} = y_n + hy'_n + 0(h^2)$$ so here the local truncation error is of the order of $h^2$.
You used Taylor's expansion taking the second derivative in to account so you have : $$y_{n+1} = y_n + hy'_n + \frac{h^2}{2} y''_n + 0(h^3)$$
so here the LTE has improved to order $h^3$ which implies a smaller error for similar stepsize.
Other ways of solving with more precision without having to calculate $y''(0)$ are "Modified Euler's" method which has a LTE of order $h^3$.
The one possibly most widely used by people solving ODE numerically is called the "classic Runge-Kutta" method with LTE of order $h^5$ which means that with a step size of $0.1$, your mistake will we some multiple of $10^{-5}$ which is rather good!
