Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
outputs of center of mass function and total energy function
  • Loading branch information
jic13003 committed Dec 5, 2015
1 parent c920ba0 commit 9fd3337
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/jat/examples/ThreeBodyExample/ThreeBodyExample.java
Expand Up @@ -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;

Expand All @@ -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);
}

}

0 comments on commit 9fd3337

Please sign in to comment.