# Euler method

1. May 20, 2004

### Pattielli

Would you please tell me how to improve Euler's approximation to be better in solving differerential equations ? Can you give me some links to this?

Thank you,

2. May 20, 2004

### TALewis

It is literally called the "improved Euler method," the "improved Euler-Cauchy method," or sometimes "Heun's method." It's known as a predictor-corrector method.

I assume you are familiar with the regular Euler method. Recall for Euler's method we are given:

$$y'=f(x,y)$$
$$y(x_0)=y_0$$

The function $f(x,y)$ tells us the slope of the function at every point, important for 'shooting' from station to station (point to point).

The first step in the improved Euler method is the "predictor" step, and it's identical to the regular Euler method:

$$y^\ast_{n+1}=y_n+hf(x_n,y_n)$$

h is the step size. The asterisk denotes the prediction of $y_{n+1}$. With this prediction, we have two slopes to consider in 'shooting' toward the next station. First is the slope of the current station we used previously:

$$y'|_n=f(x_n,y_n)$$

And then the slope at the predicted point:

$$y'|_{n+1}=f(x_{n+1},y^\ast_{n+1})$$

We can "correct" our aim by averaging these two slopes and using that as our slope to find the next point:

$$y_{n+1}=y_n+\frac{1}{2}h[f(x_n,y_n)+f(x_{n+1},y^\ast_{n+1})]$$

There you have it.

3. May 20, 2004

### Chrono

I'm a little slack on differential equations, so perhaps you can shed some light. On the RHS, what's that line?

4. May 21, 2004

### Pattielli

Thank you,

Chrono, what is RHS ?

5. May 21, 2004

### TALewis

RHS = right hand side

I don't see anything funky on the right hand side. Do you mean this:

$$y'|_{n+1}$$

If so, the vertical line doesn't really mean anything other than y' evaluated at n+1. It's a notation quirk I picked, I'm not sure if it's exactly correct.

6. May 21, 2004

### Chrono

That's what I mean. That's the left hand side, isn't it? I don't know what I was thinking when I said that. So would it mean the same without the line there?

7. May 21, 2004

### TALewis

The line doesn't really mean anything here. It's just how I chose to say "the slope at this station" and "the slope at the next station." Here's another example of the notation:

$$\tau_w = \left.\mu\frac{du}{dy}\right|_{y=0}$$

This, from fluid mechanics, says the shear stress caused by a fluid at a wall ($\tau_w$) is equal to the fluid's dynamic viscosity ($\mu$) times the derivative of the fluid velocity parallel to the wall (u) with respect to the perpendicular distance from the wall (y), evaluated at the wall ( y = 0 ).

Last edited: May 21, 2004
8. May 22, 2004

### Pattielli

Would you please tell me about Euler and improved Euler methods' applications ?
How can they be in use for what purpose but just solve the differential equations ? An even when they are used for their main purpose, what do people want to learn from their approximations ?

Thank you very much

Last edited: May 22, 2004
9. May 22, 2004

### TALewis

The Euler and improved Euler can be used to find approximate numerical solutions to differential equations of the form

$$y'=f(x,y)$$

where the initiial point of the function is given. That is to say, it is applicable to initial value problems (although it can be applied to boundary value problems through a shooting method). I'm not sure about applications of the method to problems not related to this differential equation.

In practice, we would use a numerical method like the improved Euler method to solve a differential equation where no analytical solution exists. That is to say, there are only a handful of differential equations that can be solved through calculus and algebraic manipulation to give a closed form result.

For example, the field of computational fluid dynamics (CFD) is concerned in part with numerical solutions to the Navier-Stokes equations, which govern fluid flow. The Navier-Stokes equations are a system of nonlinear, second order, partial differential equations with variable coefficients. Here is the NS equation for the x-direction:

\begin{align*} \rho\left(\frac{\partial u}{\partial t} + u\frac{\partial u}{\partial x} + v\frac{\partial u}{\partial y} + w\frac{\partial u}{\partial z}\right) =\\ -\frac{\partial p}{\partial x} + \rho g_x + \mu\left(\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} + \frac{\partial^2 u}{\partial z^2}\right) \end{align}

There are few analytical solutions to these Navier-Stokes equations. They must be solved by numerical methods in most cases.

In the case of a differential equation that cannot be solved "by hand," the numerical solution produced by method such as Euler's can provide as much information to an engineer as an exact solution. I can plot a numerical solution, numerically differentiate or integrate it, to a degree of numerical precision limited only by my time and computing power.

In practice, however, the Euler and improved Euler are not as accurate as the 4th-order Runge-Kutta method, which is another predictor-corrector "marching" method that's used more often with better results.

10. May 22, 2004

### arildno

Just a minor comment here regarding variable coefficients:
Under the assomption of small deformation rates, incompressibility of the fluid, and the validity of Newton's stress/strain rate relationship, it is quite common to express the
stress tensor P as
$$P=-pI+\mu(\nabla{\vec{v}}+(\nabla{\vec{v}})^{T})$$

where p is the pressure, $$\mu$$ the possibly variable dynamic viscosity coefficient, whereas $$\vec{v}$$ (I is the identity matrix).
In the case of a constant viscosity coefficient, the momentum equation gains the form
indicated by TALewis, in general however, we'll have the force per unit volume terms:
$$-\nabla{p}+\nabla\cdot(\mu(\nabla{\vec{v}}+(\nabla{\vec{v}})^{T}))$$

Last edited: May 23, 2004
11. May 22, 2004

### Pattielli

Thank you very much, :sm:

12. May 24, 2004