(* ::Package:: *)

(************************************************************************)
(* This file was generated automatically by the Mathematica front end.  *)
(* It contains Initialization cells from a Notebook file, which         *)
(* typically will have the same name as this file except ending in      *)
(* ".nb" instead of ".m".                                               *)
(*                                                                      *)
(* This file is intended to be loaded into the Mathematica kernel using *)
(* the package loading commands Get or Needs.  Doing so is equivalent   *)
(* to using the Evaluate Initialization Cells menu command in the front *)
(* end.                                                                 *)
(*                                                                      *)
(* DO NOT EDIT THIS FILE.  This entire file is regenerated              *)
(* automatically each time the parent Notebook file is saved in the     *)
(* Mathematica front end.  Any changes you make to this file will be    *)
(* overwritten.                                                         *)
(************************************************************************)



Gravity[{y1_,y2_,y3_,y4_,y5_,y6_}] :=Module[
{\[Mu]=1/81.45,d1,d2 },
d1 =(y2^2+y3^2+(y1+\[Mu]-1)^2)^(3/2); 
d2=(y2^2+y3^2+(y1+\[Mu])^2)^(3/2);
{y4,y5,y6,
2y5 + y1 - (\[Mu] (y1+\[Mu]-1))/d1 -((1-\[Mu])(y1+\[Mu]))/d2,
-2y4 + y2 - (\[Mu] y2)/d1 -((1-\[Mu])y2)/d2,
- ((\[Mu] y3)/d1) -((1-\[Mu])y3)/d2
}
]
IC = {0.994,0,0,0,-2.001585106370825224,0};
TMax=17.06521656015796;
ySol=y/.NDSolve[ {
y'[t]==Gravity[y[t]],
y[0]==IC
},
y,
{t, 0, TMax}][[1]];
MmaPic=ParametricPlot[ySol[t][[{1,2}]],{t,0,TMax}]



AM3={3/8, {1},{19/24,-(5/24),1/24}};
AM2={5/12, {1},{2/3,-(1/12)}};
AM4={251/720, {1},{323/360,-(11/30),53/360,19/720}};
AM5={95/288, {1},{1427/1440,-(133/240),241/720,-(173/1440),3/160}};


AB3={0, {1},{23/12,-(4/3),5/12}};
AB2 ={0, {1},{3/2,-1/2}};
AB4={0, {1},{55/24,-(59/24),37/24,-(3 /3)}};
AB5={0, {1},{1901/720,1387/360,109/30,637/360,251/720}};


BDF1={1,{1},{}};
BDF2={2/3,{4/3,-(1/3)},{}};
BDF3={6/11,{18/11,-(9/11),2/11},{}};



Clear[LMMStep]
LMMStep[{ys_,fs_},n_,h_, f_,{\[Beta]0_,\[Alpha]_,\[Beta]_}]:= Module[
{fOld=fs[[n]],yNew},
yNew=h*\[Beta]0*fOld+Sum[\[Alpha][[i]] ys[[n-i]] ,{i, Length[\[Alpha]]}]+h Sum[\[Beta][[i]] fs[[n-i]],{i, Length[\[Beta]]}];
ys[[n]]=yNew;
fs[[n]]=f[yNew];
]
SetAttributes[LMMStep,HoldFirst];



