nbo10
- 416
- 5
I'm not going to sit here and argue about this, I have too much to do. For periodic functions Eulers method is unstable. Run YOUR program using Eulers method for 100 periods check the results. It's unstable. THis is my last post about this subject.
This doesn't work, Euler method.
This does work, Euler-Kromers method.
JMD
Code:
t[i+1] = t[i] + dt;
omega[i+1] = omega[i] - (g/l) * theta[i] * dt;
theta[i+1] = theta[i] + omega[i] * dt;
Energy[i+1] = g*l*(1 - Math.Cos(3.1415*theta[i])/180 ) + 0.5 * omega[i]*omega[i];
Code:
t[i+1] = t[i] + dt;
omega[i+1] = omega[i] - (g/l) * theta[i] * dt;
theta[i+1] = theta[i] + omega[i+1] * dt;
Energy[i+1] = g*l*(1 - Math.Cos(3.1415*theta[i])/180 ) + 0.5 * omega[i]*omega[i];
JMD