# Euler’s Method y'+2y=2-e^(-4t) y(0)-1

• MHB
• karush
In summary, Euler's Method with a step size of h=0.1h=0.1 produces approximate values of the solution at tt = 0.1, 0.2, 0.3, 0.4, and 0.5. The exact values of the solution are at these points: t= 0.1, y= 1; t= 0.2, y= 0.492968; t= 0.3, y= 0.0492968; t= 0.4, y= -0.14353; t= 0.5, y= -0.20703.
karush
Gold Member
MHB
Use Euler’s Method with a step size of h=0.1h=0.1
to find approximate values of the solution at
tt = 0.1, 0.2, 0.3, 0.4, and 0.5.
Compare them to the exact values of the solution at these points.

Given IVP
$$y'+2y=2-{{\bf{e}}^{- 4t}}\quad yt(0)=1$$
ok from a previous post we found that the general solution was
$$y( t ) = 1 + \frac{1}{2}{{\bf{e}}^{ - 4t}} - \frac{1}{2}{{\bf{e}}^{ - 2t}}$$ Steward gives this for Euler's Method so not real sure how to follow this
https://www.physicsforums.com/attachments/8742​
Have to go to class, but will back on this when I get back.

First, express the ODE in the form:

$$\displaystyle y'=f(t,y)$$

And then iterate the recursion:

$$\displaystyle y_{n+1}=y_n+hf\left(t_n,y_n\right)$$

where:

$$\displaystyle t_{n+1}=t_n+h$$

$$\displaystyle h=0.1,\,t_0=0,\,y_0=1$$

Euler's method approximates the derivative, $$y'= \frac{dy}{dx}$$, by the "difference quotient $$\frac{\Delta y}{\Delta x}$$: here $$\frac{\Delta y}{\Delta x}= -2y- e^{-4t}$$ or $$\Delta y= (-2y- e^{-4t})\Delta x$$.

Start with t= 0, y= 1. Taking $$\Delta t= 0.1$$, $$\Delta y= (-2- e^0)(0.1)= -0.3$$ so the next step is t= 0+ 0.1= 0.1, y= 1- 0.3= 0.7. Now, $$\Delta t$$ is still 0.1 and $$\Delta y= (-2(0.7)- e^{-0.4})(0.1)= (-1.4- 0.67032)(0.1)= -0.20703$$. The third step is $$t= 0.1+ 0.1= 0.2$$ and $$y= 0.7- 0.20703= 0.492968$$. $$\Delta t= 0.1$$ and $$\Delta y= (-2(0.492968)- e^{-0.8})(0.1)= -0.14353$$. The fourth step is $$t= 0.2+ 0.1= 0.3$$ and $$y= 0.492968- 0.14353= 0.0492968$$. Continue two more times.

Country Boy said:
Euler's method approximates the derivative, $$y'= \frac{dy}{dx}$$, by the "difference quotient $$\frac{\Delta y}{\Delta x}$$: here $$\frac{\Delta y}{\Delta x}= -2y- e^{-4t}$$ or $$\Delta y= (-2y- e^{-4t})\Delta x$$.

wait isn't
$$\displaystyle y'=\frac{\Delta y}{\Delta x}= (2-2y- e^{-4t})$$
$$\Delta y = (2-2y- e^{-4t}) \Delta x$$

MarkFL said:
First, express the ODE in the form:

$$\displaystyle y'=f(t,y)$$

And then iterate the recursion:

$$\displaystyle y_{n+1}=y_n+hf\left(t_n,y_n\right)$$

where:

$$\displaystyle t_{n+1}=t_n+h$$

$$\displaystyle h=0.1,\,t_0=0,\,y_0=1$$

so $$f(t,y)=f(0,1)=2-2(0)-e^{-4(0)}=2-1=1$$

karush said:
so $$f(t,y)=f(0,1)=2-2(0)-e^{-4(0)}=2-1=1$$

$$\displaystyle y'=f(t,y)=2-e^{-4t}-2y$$

And so:

$$\displaystyle y_{n+1}=y_n+h\left(2-e^{-4t_n}-2y_n\right)$$

We then begin with:

$$\displaystyle y(0)=y_0=1$$ and $$\displaystyle t_0=0$$

$$\displaystyle y(0.1)\approx y_1=y_0+h\left(2-e^{-4t_0}-2y_0\right)=1+0.1\left(2-e^{-4\cdot0}-2\cdot1\right)=1+0.1(2-1-2)=0.9$$

For comparison:

$$\displaystyle y(0.1)=1+\frac{1}{2}e^{-0.4}-\frac{1}{2}e^{-0.2}\approx0.9257946$$

Now, continue iterating and comparing. :)

## 1. What is Euler’s Method?

Euler’s Method is a numerical method used to approximate the solution to a first-order differential equation. It is based on the idea of breaking down a continuous function into smaller intervals and using the slope of the function at a given point to estimate the value at the next point.

## 2. What is the differential equation in Euler’s Method y'+2y=2-e^(-4t) y(0)-1?

The differential equation in this case is y'+2y=2-e^(-4t) with the initial condition y(0)-1. This means that the rate of change of y with respect to t is equal to 2-e^(-4t) minus 2 times the current value of y, with an initial value of y at t=0 being 1.

## 3. How do you use Euler’s Method to approximate the solution to the differential equation?

To use Euler’s Method, we first choose a step size, h, which represents the size of the intervals we will use to approximate the solution. Then, we use the initial condition to find the value of y at the first point, y(0). From there, we use the formula y(n+1) = y(n) + h * f(t(n), y(n)), where f(t,y) is the given differential equation, to find the value of y at the next point. We repeat this process until we have reached the desired value of t.

## 4. What is the significance of the initial condition in Euler’s Method?

The initial condition is used to find the value of y at the first point, which is necessary for the subsequent calculations. It represents a known point on the solution curve and is used as a starting point for the approximation process.

## 5. How accurate is Euler’s Method in approximating the solution to a differential equation?

Euler’s Method is a first-order method, meaning that the error in the approximation is proportional to the step size, h. Therefore, as the step size decreases, the accuracy of the approximation improves. However, for more complex differential equations, Euler’s Method may not provide an accurate enough approximation and other methods, such as the Runge-Kutta method, may be more suitable.

Replies
7
Views
3K
Replies
9
Views
2K
Replies
7
Views
2K
Replies
11
Views
3K
Replies
4
Views
3K
Replies
10
Views
2K
Replies
9
Views
5K
Replies
1
Views
1K
Replies
1
Views
2K
Replies
6
Views
2K