I'm trying to solve the following problem:
Find approximations for the PVI solution on mesh [0,1] with h=0.25:
$y'=y-\frac{2x}{y}$
$y(0)=1$
I thought about use Euler's method to do it, $U^{n+1} = U^{n} +h (U^n, t_n)$. But there is a problem, in doing so I find an indeterminacy, as you can see:
$Y^0 = y(0) = 1$
$Y^1 = Y^0+hf(Y^0,x_0) = 1+0.25\cdot f(1,0)=1+0.25[0-\frac{2\cdot1}{0}]$
Is there other way to do it, or the range [0,1] would be wrong?
Euler's Method has an iteration formula of
$$y_{i+1} = y_i + h f(x_i, y_i) = y_i + 0.25 \left(y_i - \dfrac{2x_i}{y_i}\right)$$
It looks like you swapped the $x$ and $y$ values in your iteration formula, and that is causing your problem.
The iterates are given by
$$\left( \begin{array}{ccc} \text{x} & \text{y} \\ 0. & 1. \\ 0.25 & 1.25 \\ 0.5 & 1.4625 \\ 0.75 & 1.65718 \\ 1. & 1.84519 \\ \end{array} \right)$$
See if you swap the $x$ and $y$ values in your iteration formula, if you an duplicate this result and answer back if you have issues.
You can solve this differential equation to compare to Euler's.
The result is
$$y(x) = \sqrt{2x+1}$$
The values in $0.25$ steps are
$$\{1.,1.22474,1.41421,1.58114,1.73205\}$$
You an improve the results by making $h$ smaller, like $h=0.01$.