]>
Commit | Line | Data |
---|---|---|
4124db17 P |
1 | # Pendulum: Comparing Harmonic Oscillator with 4th order Taylor approximation |
2 | ||
3 | ### Taylor 4 approximation: phi'' = - g/r * (phi - 1/6 * phi^3) | |
4 | # fortunately, the components of orders 0, 2 and 4 are zero | |
5 | ||
6 | coefficient.1 -> g/r | |
7 | coefficient.2 -> 1/6 # set to 0,167 or 0 (for harmonic solution) | |
8 | coefficient.3(-1) -> -phi0 | |
9 | ||
10 | iintegrate phi'' -> -phi' | |
11 | iintegrate -phi' -> phi | |
12 | IC: -phi0 | |
13 | ||
14 | multiply phi, phi -> phi^2 | |
15 | multiply phi^2, phi -> phi^3 | |
16 | invert phi^3 -> -phi^3 | |
17 | ||
18 | cmultiply 1/6, -phi^3 -> -1/6*phi^3 | |
19 | isum phi, -1/6*phi^3 -> -(phi-1/6*phi^3) | |
20 | cmultiply -(phi-1/6*phi^3), g/r -> -g/r*(phi-1/6*phi^3) | |
21 | assign -g/r*(phi-1/6*phi^3) -> phi'' | |
22 | ||
23 | output phi -> out.x | |
24 | ||
25 | ### Harmonic oscillator: phi'' = - g/r * phi | |
26 | coefficient.5 -> g/r_h # identical to g/r | |
27 | coefficient.7(-1) -> -phi0_h # identical to -phi0 | |
28 | ||
29 | iintegrate phi_h'' -> -phi_h' | |
30 | iintegrate -phi_h' -> phi_h | |
31 | IC: -phi0_h | |
32 | invert phi_h -> -phi_h | |
33 | ||
34 | cmultiply -phi_h, g/r_h -> -g/r*phi_h | |
35 | assign -g/r*phi_h -> phi_h'' | |
36 | ||
37 | output phi_h -> out.y |