See the attached file for the formulas.
Determine an appropriate step size h by assuming that an h that works as expected for simple harmonic motion is good enough for the given initial angle. In particular, if the position at the end of one period is within 0.1% of the original point, we'll be satisfied.© BrainMass Inc. brainmass.com November 24, 2021, 11:09 am ad1c9bdddf
See attached file.
I chose to solve this using Euler's method. First you have to convert the second-order ODE into two first-order ODEs.
Let v = theta'
Since theta'' = v', v' = -(g/l)*theta.
With me this far? Please try to make the above make sense to you. All we are doing is breaking the problem up into two smaller problems.
Now we have to iterate with the following (where i denotes the discrete time interval):
theta[i+1] = ...
The solution provides good explanations and alternative methods used in solving the problems.