# Pendulum: Comparing Harmonic Oscillator with 4th order Taylor approximation ### Taylor 4 approximation: phi'' = - g/r * (phi - 1/6 * phi^3) # fortunately, the components of orders 0, 2 and 4 are zero coefficient.1 -> g/r coefficient.2 -> 1/6 # set to 0,167 or 0 (for harmonic solution) coefficient.3(-1) -> -phi0 iintegrate phi'' -> -phi' iintegrate -phi' -> phi IC: -phi0 multiply phi, phi -> phi^2 multiply phi^2, phi -> phi^3 invert phi^3 -> -phi^3 cmultiply 1/6, -phi^3 -> -1/6*phi^3 isum phi, -1/6*phi^3 -> -(phi-1/6*phi^3) cmultiply -(phi-1/6*phi^3), g/r -> -g/r*(phi-1/6*phi^3) assign -g/r*(phi-1/6*phi^3) -> phi'' output phi -> out.x ### Harmonic oscillator: phi'' = - g/r * phi coefficient.5 -> g/r_h # identical to g/r coefficient.7(-1) -> -phi0_h # identical to -phi0 iintegrate phi_h'' -> -phi_h' iintegrate -phi_h' -> phi_h IC: -phi0_h invert phi_h -> -phi_h cmultiply -phi_h, g/r_h -> -g/r*phi_h assign -g/r*phi_h -> phi_h'' output phi_h -> out.y