Appendix 2: Swing Equation Programming Code