diff --git a/src/jat/examples/ThreeBodyExample/ThreeBodyAPL.java b/src/jat/examples/ThreeBodyExample/ThreeBodyAPL.java index f22a529..aa379c1 100644 --- a/src/jat/examples/ThreeBodyExample/ThreeBodyAPL.java +++ b/src/jat/examples/ThreeBodyExample/ThreeBodyAPL.java @@ -18,16 +18,29 @@ public class ThreeBodyAPL extends ThreeBody implements FirstOrderDifferentialEqu public ArrayList ysol = new ArrayList(); public ArrayList zsol = new ArrayList(); + /* + * Why we created the ThreeBodyAPL: + * The APL is responsible for computing the derivatives used in the ThreeBodyExample and interpolating data + * APL stands for Applied Physics Laboratory + */ + + /* + * What we used from existing code + * The information that this class uses from the ThreeBody class are calculations for: + * Masses, center of mass and energy. + * This is usefull for us because all of this is necessary for our modification + */ + public ThreeBodyAPL(double G, double m1, double m2, double m3) { super(G, m1, m2, m3); } - + @Override public void computeDerivatives(double t, double[] y, double[] yDot) { // returns the derivatives of the ThreeBody problem yDot = this.derivs(t, y); } - + @Override public int getDimension() { // returns a dimension of 6 diff --git a/src/jat/examples/ThreeBodyExample/ThreeBodyExample.java b/src/jat/examples/ThreeBodyExample/ThreeBodyExample.java index 0b5585f..cd9a912 100644 --- a/src/jat/examples/ThreeBodyExample/ThreeBodyExample.java +++ b/src/jat/examples/ThreeBodyExample/ThreeBodyExample.java @@ -19,6 +19,13 @@ import org.apache.commons.math3.linear.RealVectorFormat; import org.apache.commons.math3.ode.FirstOrderIntegrator; import org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator; +/* + * We modified the ThreeBodyProblem by emulating the two body problem, and expanding it to ThreeBody + * Elements of two body, such as the orbit calculations, were not as heavily focused on + * We acknowledge that some of our calculations may be a bit inaccurate because some of the math got a bit over our heads + * + * @author Maegan and John + */ public class ThreeBodyExample { public ThreeBodyExample() { @@ -53,8 +60,21 @@ public class ThreeBodyExample { VectorN cm = sat.center_of_mass(y); // obtain current energy + totalEnergy = sat.Energy(y); - + /* + * Notes about the calculations: + * Dormand Prince is a type of Runge-Kutta diff eq. (another method of checking diff eq) + * Errors are calculated looking at 4th and 5th level differential equations + * These were most likely chosen by the original creator of the project because they take the error into account fairly accurately + * In relation to physics, this calculates the relative orbits for the bodies + * The step handler is another type of analyzing the algorithms for each body + * These provide fairly accurate results + * + * In general, these equations went over our heads, but refer to the NASA site as well as + * look into other resources to get more information on 3-Body calculations + * + */ // propagate the orbit FirstOrderIntegrator dp853 = new DormandPrince853Integrator(1.0e-8, 100.0, 1.0e-10, 1.0e-10); dp853.addStepHandler(sat.stepHandler);