Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Comments on the code are more extensive and clear up some of the
confusion we've been having with what things are and how they work as
well as why we implemented certains classes and functions the way we did

Needs to be further updated as well
  • Loading branch information
mxd12001 authored and mxd12001 committed Dec 7, 2015
1 parent 51ab91f commit 9d8b1db
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
17 changes: 15 additions & 2 deletions src/jat/examples/ThreeBodyExample/ThreeBodyAPL.java
Expand Up @@ -18,16 +18,29 @@ public class ThreeBodyAPL extends ThreeBody implements FirstOrderDifferentialEqu
public ArrayList<Double> ysol = new ArrayList<Double>();
public ArrayList<Double> zsol = new ArrayList<Double>();

/*
* 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
Expand Down
22 changes: 21 additions & 1 deletion src/jat/examples/ThreeBodyExample/ThreeBodyExample.java
Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9d8b1db

Please sign in to comment.