+IDENTIFICATION DIVISION
+PROGRAM-ID HarmonicOscillator
+VERSION 20240201
+COMMENT A mass m is subject to a force F=-k*r.
+COMMENT What is the trajectory if the mass starts at position (a,0,0)?
+COMMENT How much time does it take to pass through zero?
+COMMENT What is the trajectory if it starts at (a,0,0) with velocity (0,v0,0)?
+COMMENT m*x'' = -k*x
+COMMENT m*y'' = -k*y (z can be set to 0).
+
+ENVIRONMENT DIVISION
+ENGINE Anabrid-THAT
+TIMEBASE 1ms
+REQUIRES COEFFICIENT 4, INTEGRATOR 4, INVERTER 2
+
+DATA DIVISION
+OUTPUT OUTPUT.X x
+OUTPUT OUTPUT.Y y
+COEFFICIENT.1 A # (a,0,0)
+COEFFICIENT.2 K/M_x # k/m for x
+COEFFICIENT.3 V0 # (0,v0,0)
+COEFFICIENT.4 K/M_y # k/m for y, identical to k/m for x
+
+PROGRAM DIVISION
+-1 -> COEFFICIENT.A -> -a # has to be negative because x' is negative
++1 -> COEFFICIENT.V0 -> v0 # has to be positive because y'' is positive
+
+x'' -> INTEGRATOR -> -x'
+-x', IC:-a -> INTEGRATOR -> x
+x -> COEFFICIENT.K/M_x -> k/m*x
+k/m*x -> INVERTER -> -k/m*x = x''
+
+y'', IC:v0 -> INTEGRATOR -> -y'
+-y' -> INTEGRATOR -> y
+y -> COEFFICIENT.K/M_y -> k/m*y
+k/m*y -> INVERTER -> -k/m*y = y''
+
+OPERATION DIVISION
+MODE REPEAT
+OP-TIME 100 ms