Tygra said:
Unfortunately, Vela, no. It is still behaving like haruspex said.
View attachment 355961
This is
the problem you should be attacking prior to adding things like drag. If one cannot get even the simplest case to behave more or less correctly it is time to change techniques. In the case of an undamped pendulum, the peak amplitude during each cycle should remain more or less constant.
In the case of Euler's method applied to an undamped pendulum, this technique inevitably accumulates energy and eventually swings over the top. How long it takes this to happen depends on the step size. Decrease the step size and it will still happen, at least up to a point. At some point, you'll reach the problem of 1+1e-16 is exactly 1 on most computers. With too small a step size, any numerical integrator will eventually produce a non-moving pendulum, but it will take a long, long time to achieve that nonsense result.
In contrast, the symplectic Euler method tends to have total energy (and hence peak amplitude) oscillate a bit about the true value from step to step. There are much better symplectic integrators than symplectic Euler. You'll be able to take much bigger steps compared to symplectic Euler with those better techniques and still maintain good accuracy.
I mentioned leapfrog in a previous reply. Leapfrog is symplectic and is still simple to implement but it is much better than is symplectic Euler. Leapfrog lets one double the step size at no cost to accuracy, or it lets one keep the same step size with significantly better accuracy than symplectic Euler. Using bigger steps is important because the number of calls to the derivative function is a key driver of the computational cost. A technique that lets one double the step size at no cost to accuracy halves the number of derivative function calls. People have developed much higher order symplectic integrators than leapfrog.
If you take a class that covers numerically integrating an initial value problem (an ODE with given initial values), one of the first things the instructor will teach is almost inevitably Euler's method. The next thing you will be taught is to never use Euler's method, with examples. Euler's method is fine for teaching because it introduces the subject. In addition, several better integrators use Euler-like steps as intermediate steps. It's important to learn Euler's method. It's also important to learn not to use it.