Numerical Solution for ODE with a squared term inhibiting use of Euler's Method

84 Views Asked by At

I have this ODE:

$$A(x)\ddot{x}+B(x)\dot{x}^2+C(x) = 0$$

$A,B,C$ are functions of $x(t)$. Usually I'd solve this numerically using Euler's method but in this case the $\dot{x}^2$ is giving me problems since I cannot solve the equation for $x(t+\delta)$ because I have both $x(t+\delta)$ and $x(t+\delta)^2$.

What does one do in this case? I am open to using other numerical methods as well...

1

There are 1 best solutions below

2
On

You should not use any Euler method to solve anything serious.

If you want to apply any Runge-Kutta or one-step method, you need to transform the ODE into a first order system \begin{align} \dot x &= v\\ \dot v &= -\frac{B(x)v^2+C(x)}{A(x)} \end{align} To this first order system you can now apply any Runge-Kutta method, not only the highly inefficient Euler method.