I would like to solve the following differential equation numerically:
$$(1 + (y')^2) (y - c) - y' x = 0$$ where $y$ is a function of $x$, and $y(0) = a$ and $y'(0) = b$.
I was looking into Runge Kutta methods but it requires the equation to be in the following format:
$$y' = f(x, y)$$
If I can achieve this, then it's straightforward to solve it with Runge-Kutta. But I don't see how it's possible to get it into this format.
\begin{align} 0 &= (1 + (y')^2) (y - c) - y' x \\ 0 &= (y-c) + (y')^2 (y - c) - y' x \\ 0 &= (y')^2(y - c) - y' x + (y - c) \\ 0 &= (y-c) \left[ (y')^2 - y' \frac{x}{y-c} + \left( \frac{x}{2(y-c)}\right)^2 - \left( \frac{x}{2(y-c)}\right)^2 \right]+ (y - c) \\ 0 &= (y-c) \left[y' - \frac{x}{2(y-c)}\right]^2 - (y-c)\frac{x^2}{4(y-c)^2}+ (y-c) \\ 0 &= (y-c) \left( \left[y' - \frac{x}{2(y-c)}\right]^2 - \frac{x^2}{4(y-c)^2}+ 1 \right) \\ \end{align} At this point, we can say that either $y-c$ is zero, or the other term is zero; the first case is pretty simple (and is a valid solution!); the second gives us
\begin{align} 0 &= \left[y' - \frac{x}{2(y-c)}\right]^2 - \frac{x^2}{4(y-c)^2}+ 1 \\ \frac{x^2}{4(y-c)^2}- 1 &= \left[y' - \frac{x}{2(y-c)}\right]^2 \\ \pm \sqrt{ \frac{x^2}{4(y-c)^2}- 1} &= y' - \frac{x}{2(y-c)} \\ \frac{x}{2(y-c)} \pm \sqrt{ \frac{x^2}{4(y-c)^2}- 1} &= y' \\ \end{align} which expresses $y'$ as a function of $x$ and $y$ as required. Near $x = 0$, you'll have to choose a particular branch of the square root, however. That's hardly surprising, given that $y'^2$ appears in the original equation.