Compute a chi^2 map
// Outputs a chi^2 map for a range of periods and eccentricities of the innermost planet
import systemic.*;
Kernel k = new Kernel();
k.loadFit("template.fit");
k.setIntMethod(0);
int steps = 10;
double P1 = 10;
double P2 = 20;
double dP = (P2 - P1) / steps;
double e1 = 0;
double e2 = 0.5;
double de = (e2 - e1) / steps;
// template orbital elements
double[][] els = k.getElements();
// open output file
PrintWriter pw = new PrintWriter(new FileWriter("map.txt"));
for (int i = 0; i < steps; i++)
for (int j = 0; j < steps; j++) {
double P = P1 + i * dP;
double e = e1 + j * de;
els[0][PER] = P;
els[1][ECC] = e;
k.setElements(els);
k.calculate();
pw.print(String.format("%10.2e %10.2e %10.2e", new Object[] {P, e, k.getChiSqr()}));
}
pw.close();
Integrate a system forward in time
// Integrates a system forward for 1000 years using Bulirsch-Stoer
import systemic.*;
Kernel k = new Kernel();
k.loadFit("template.fit");
output.println("Initial elements:");
k.printElements();
k.setIntMethod(7);
k.integrate(0, 1000. * 365.25, 1e-3, false);
output.println("Final elements:");
k.printElements();