# Thread: ODE Solved Using Euler Method

1. ## ODE Solved Using Euler Method

I get the feeling I'm making a mistake somewhere here since the error is extremely high

Problem:
Compute by hand using the Euler Method given:

$y' = -100y+1$
$y(0)=1$

Attempt:

Euler Method: yi+1= yi + h*f(ti,yi) where h is the arbitrary step size which in this case will be 0.1
yi = 0
h = 0.1
f(ti,yi) = f(0,1) = -100(1) + 1 = -99
yi+1= 1 + (-99)(0.1) = -8.9

To calculate percent error, find the exact solution.
Solving the ODE yields:
y = 1/100 + 99/(100*e100t)

Plugging in 0.1 for t yields approximately 0.01005 for the exact solution as opposed to -8.9 in the approximated solution

2. ## Re: ODE Solved Using Euler Method

Originally Posted by spruancejr
Euler Method: yi+1= yi + h*f(ti,yi) where h is the arbitrary step size which in this case will be 0.1
yi = 0
h = 0.1
f(ti,yi) = f(0,1) = -100(1) + 1 = -99
yi+1= 1 + (-99)(0.1) = -8.9
In the 4th and 5th lines you've taken $y_i$ as 1 instead of 0.

Thanks!

4. ## Re: ODE Solved Using Euler Method

I incorrectly entered the initial condition.