# Example of a engineering problem solved using the Euler's method

I'm new to this forum, mechanical engineering and to matlab as well and this will be my first true academic work at university. I'm only at the 1st semester of my course and really need some help.

So, here's the problem: I need to find a suitable engineering problem; Apply the Euler's method in it to solve it; Code the program to solve this problem in Matlab, Octave or Scilab; And explain it.

And, here's my real difficulty: I searched a lot and didn't really understood how this method Works and where could i apply it. And i don't have a really great base in math to do it. But im trying really hard and i want to learn it.

So, can someone give me an example of a real engineering problem solved with the Euler's method and explain it? It does not need to be much complex. A simple example and problem will be sufficient. And some idea for the code, if is not asking for much.

Searched a lot around the web. Tried books, but most of them had very difficult languages to understand or had no examples.

I'm kind slow for getting to understand these things. But anyways, thanks for your time and i'll be very grateful for anyone who can help me. (I reposted this here because i think this question belongs in the math fórum.. if not sorry!)

• Can you show us the last initial value problem and the last MATLAB code discussed in your class? – Carl Christian Apr 17 at 7:29
• We were working with bissection and Newton's method. But for this one i don't have any because one of my tasks is to create it.... this is why i'm asking for help lol i need some ideas to know where and how to start. – Higor G. Apr 17 at 20:49

Given an initial value problem of the form $$\begin{cases}y'=f(t,y)\\ y(t_0)=y_0\end{cases},$$

Euler's method consists in, knowing the value of $$y$$ at a certain moment in time, say $$y(t)$$, approximating the value of $$y$$ at the next time step $$t+h$$ by using a linear approximation. In fact, using Taylor's formula, you know that $$y(t+h) \approx y(t) + y'(t) h = y(t) + h f(t,y(t))$$ So, the approximations in prescribed time steps $$t_0,t_0+h, t_0+2h, \cdots$$ are given recursively by

$$y_{i+1} = y_i + h f(t_i, y_i).$$

The method can be adapted easily for systems of equations. The convergence order is not great and you must be prepared to use very small values of the time step $$h$$ in order to get accurate results.

A very nice example is the spherical pendulum. It is a system of 3 second order differential equations that you can rewrite as a system of 6 first order equations and solve with Euler's method. Below you can find an example of the trajectory of a spherical pendulum.

The equation for the pendulum is $$X'' = F - \frac{(X')^T H X' + \nabla \Phi F}{\|\nabla \Phi\|^2} \nabla \Phi$$

Where $$\Phi(x_1,x_2,x_3) = x_1^2+x_2^2 + x_3^2-1$$, $$\nabla \Phi$$ is its gradient and $$H$$ its Hessian matrix. Naturally $$X(t)=(x_1(t),x_2(t),x_3(t))$$ is the position of the pendulum at each time step and $$X', X''$$ the velocity and acceleration. Finally, $$F=(0,0,-g)$$ where $$g \approx 9.8$$.

• Seems pretty interesting. I'll gonna give this a try, then i come back. Thanks for now! – Higor G. Apr 17 at 20:50