# Thread: Numerical Integration of ODE

1. ## Numerical Integration of ODE

Find using Euler approximation to the solution of Initial Value Problem:

$y' = x - y - 2$
$y(0) = 2$
[0,1], with step h = 0.1

My solution
I find:
$y_1 = 1.6$; $x_1 = 0.1$
$y_2 = 1.25$; $x_2 = 0.2$

Analytical Solution:
$y(x) = \frac{x^2}{2} - 2x$
$y(x_2) = -0.38$
Global error: $-0.38 - 1.25 = -1.63$
It's correct ???

2. Originally Posted by Apprentice123
Find using Euler approximation to the solution of Initial Value Problem:

$y' = x - y - 2$
$y(0) = 2$
[0,1], with step h = 0.1

My solution
I find:
$y_1 = 1.6$; $x_1 = 0.1$
$y_2 = 1.25$; $x_2 = 0.2$
You are asked to solve this over the interval [0,1] so you will have 11 points corresponding to x=0,0.1,..1.0

Analytical Solution:
$y(x) = \frac{x^2}{2} - 2x$
$y(x_2) = -0.38$
Global error: $-0.38 - 1.25 = -1.63$
It's correct ???
Your analytic solution does not satisfy the initial conditions!

CB

3. Originally Posted by CaptainBlack
You are asked to solve this over the interval [0,1] so you will have 11 points corresponding to x=0,0.1,..1.0

Your analytic solution does not satisfy the initial conditions!

CB
The analytical solution would be:
$y(x) = \frac{x^2}{2} + x(y-2)$
??

4. Originally Posted by Apprentice123
The analytical solution would be:
$y(x) = \frac{x^2}{2} + x(y-2)$
??
You've actually gotten colder, compared to your original post. This is also a linear first order inhomogeneous ode and can be solved by various means, i personally opted for finding an integrating factor, for both this equation and for the other equation in the Runge-Kutta thread. I need to sleep now but you should be able to find all the details you need to find the solution at, Integrating Factor -- from Wolfram MathWorld .

EDIT: Well don't i feel silly, should have pointed you here first, http://www.mathhelpforum.com/math-he...ial-38182.html .