function [mass,xyz,vxyz] = gen_3body
% GEN_3BODY : Generate dataset for nbody simulation
%
% [mass,xyz,vxyz] = gen_3body;
%
% Output is a three arrays of initial values for n-body simulation.
%    mass : 3-by-1 array of masses in kg
%    xyz  : 3-by-3 array of positions in m
%    vxyz : 3-by-3 array of velocities in m/sec
%
% The configuration is the stable choreography of 3 bodies moving
% in a figure 8 pattern (i.e. a reel of three), as described in:
%    A. Chenciner & R. Montgomery, "A remarkable periodic solution
%    of the three-body problem in the case of equal masses,"
%    Annals of Math. 152: 881-901, 2000.
%
% John R. Gilbert  12 June 2015
%
% nb: This is scaled wrong.  A clue to the right scaling is presumably
% the paper's statement that "we choose units so that the gravitational
% constant is 1".

scale = 1e12;

mass = [1; 1; 1] * scale;

xyz1 = [0.97000436, -0.24308753, 0] * scale;
xyz2 = - xyz1;
xyz3 = [0, 0, 0];
xyz  = [xyz1 ; xyz2; xyz3];

vxyz3 = [-0.93240737, -0.86473146, 0] * scale;
vxyz2 = - vxyz3/2;
vxyz1 = vxyz2;
vxyz  = [vxyz1; vxyz2; vxyz3];
