Euler’s method for different differential equations

euler's methodordinary differential equations

I have equation:
\begin{align*}
\frac{\mathrm{d}y}{\mathrm{d}t} = -0.04\sqrt{y}
\end{align*}

How would I find the expression for Euler's method? I know the general expression is:

$$y_n=y_{n-1}+h\cdot F(t_{n-1},y_{n-1})$$

but I am confused with what to use as x and y and how I could convert $-0.04\sqrt{y}$ into that form.

Edit: increments of $1$ second, $y(0) = 3$.

Best Answer

Let's consider the initial condition

$$y(0)=y_0.$$

Then

$$y'(0)=F(0,y_0)=-0.04 \sqrt{y_0}.$$

Then assuming a time step $\Delta t=h$ we can estimate

$$y(h)\approx y_1= y(0)+y'(0)\cdot \Delta t=y_0+y'_0\cdot h \implies F(h,y_1)=-0.04 \sqrt{y_1}.$$

Then

$$y(2h)\approx y_2=y_1+h\cdot F(h,y_0) \implies F(2h,y_2)=-0.04 \sqrt{y_2}$$

and so on.

Refer also to