diff --git a/src/jat/examples/ThreeBodyExample/ThreeBodyAPL.java b/src/jat/examples/ThreeBodyExample/ThreeBodyAPL.java index d7cffbd..80e2580 100644 --- a/src/jat/examples/ThreeBodyExample/ThreeBodyAPL.java +++ b/src/jat/examples/ThreeBodyExample/ThreeBodyAPL.java @@ -60,23 +60,23 @@ public class ThreeBodyAPL extends ThreeBody implements FirstOrderDifferentialEqu // vector v3 is x[15], x[16], x[17] double[] randv = new double[18]; randv[0] = 2.0; - randv[1] = 6.0; - randv[2] = 7.0; + randv[1] = 3.0; + randv[2] = 3.0; randv[3] = 4.0; - randv[4] = 8.0; - randv[5] = 7.0; - randv[6] = 5.0; - randv[7] = 8.0; - randv[8] = 3.0; - randv[9] = 6.0; - randv[10] = 8.0; - randv[11] = 9.0; - randv[12] = 0.0; - randv[13] = 7.0; - randv[14] = 4.0; - randv[15] = 5.0; + randv[4] = 5.0; + randv[5] = 5.0; + randv[6] = 4.0; + randv[7] = 5.0; + randv[8] = 6.0; + randv[9] = 7.0; + randv[10] = 7.0; + randv[11] = 8.0; + randv[12] = 9.0; + randv[13] = 0.0; + randv[14] = 0.0; + randv[15] = 7.0; randv[16] = 7.0; - randv[17] = 8.0; + randv[17] = 7.0; return randv; } @@ -87,11 +87,24 @@ public class ThreeBodyAPL extends ThreeBody implements FirstOrderDifferentialEqu public void handleStep(StepInterpolator interpolator, boolean isLast) { double t = interpolator.getCurrentTime(); double[] y = interpolator.getInterpolatedState(); + // takes first mass elements and adds it to array System.out.println(t + " " + y[0] + " " + y[1]+ " " + y[2]); time.add(t); xsol.add(y[0]); ysol.add(y[1]); zsol.add(y[2]); + // takes second mass elements and adds it to array + System.out.println(t + " " + y[6] + " " + y[7]+ " " + y[8]); + time.add(t); + xsol.add(y[6]); + ysol.add(y[7]); + zsol.add(y[8]); + //takes third mass elements and adds it to array + System.out.println(t + " " + y[12] + " " + y[13]+ " " + y[14]); + time.add(t); + xsol.add(y[12]); + ysol.add(y[13]); + zsol.add(y[14]); } }; diff --git a/src/jat/examples/ThreeBodyExample/ThreeBodyExample.java b/src/jat/examples/ThreeBodyExample/ThreeBodyExample.java index a7f73d6..e70c4ff 100644 --- a/src/jat/examples/ThreeBodyExample/ThreeBodyExample.java +++ b/src/jat/examples/ThreeBodyExample/ThreeBodyExample.java @@ -118,16 +118,16 @@ public class ThreeBodyExample { // test outputs // output derivatives - for (int i = 0; i< derivs.length; i++) - { - System.out.println(derivs[i]); - } + //for (int i = 0; i< derivs.length; i++) + //{ + // System.out.println(derivs[i]); + //} // output center of mass - System.out.println(cm); + System.out.println("\nCenter of Mass: "+ cm); // output total energy of the system - System.out.println(totalEnergy); + System.out.println("Total Energy of the System: "+ totalEnergy + "\n"); new FrameView(p).setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); System.out.println("end");