diff --git a/src/jat/examples/ThreeBodyExample/ThreeBodyExample.java b/src/jat/examples/ThreeBodyExample/ThreeBodyExample.java index 890744b..ecdf71b 100644 --- a/src/jat/examples/ThreeBodyExample/ThreeBodyExample.java +++ b/src/jat/examples/ThreeBodyExample/ThreeBodyExample.java @@ -27,6 +27,8 @@ public class ThreeBodyExample { // Class that solves a three body problem and plots it ThreeBodyExample x = new ThreeBodyExample(); + //initialize variables + double totalEnergy = 0; // set the final time = one orbit period double tf = 2.0; @@ -46,19 +48,24 @@ public class ThreeBodyExample { // set the initial time to zero double t0 = 0.0; + // obtain center of mass + VectorN cm = sat.center_of_mass(y); + + // obtain current energy + totalEnergy = sat.Energy(y); // propagate the orbit //FirstOrderIntegrator dp853 = new DormandPrince853Integrator(1.0e-8, 100.0, 1.0e-10, 1.0e-10); //dp853.addStepHandler(sat.stepHandler); // double[] y = new double[] { 7000.0, 0, 0, .0, 8, 0 }; // initial // state - //test loop - + //test outputs for (int i = 0; i< derivs.length; i++) { System.out.println(derivs[i]); } - + System.out.println(cm); + System.out.println(totalEnergy); } }