1 # Gravity–2-dimensional.LACE
3 # The small mass m moves within the gravitational potential of a mass M.
4 # The situation is analysed in polar coordinates.
6 # r'' = r * phi'^2 - gamma*M/r^2
7 # phi'' = -2* r' / r * phi'
9 include CompoundFunctions.LACE # idivide
11 coefficient(1): +1 -> r0' # -1 to move initially towards M, +1 to move away from it
12 coefficient(2): -1 -> -r0 # initial distance of m to M
13 coefficient(3): +1 -> phi0'
14 coefficient(4): -1 -> -phi0
15 coefficient(5): +1 -> gamma*M
17 iintegrate r*phi'^2, -gamma*M/r^2 -> -r' # input is r''
22 iintegrate -r'/r*phi', -r'/r*phi' -> -phi' # input is phi''
24 iintegrate -phi' -> phi
27 multiply r, -phi' -> -r*phi'
28 multiply -r*phi', -phi' -> r*phi'^2
30 idivide gamma*M, r^2 -> -gamma*M/r^2
32 idivide -r', -r*phi' -> r'/r*phi'
33 invert r'/r*phi' -> -r'/r*phi'
35 output(x): r # distance
36 output(y): phi # angle