Sam Calisch, 2012
calisch@mit.edu
String oscillations adapted from http://library.wolfram.com/infocenter/Demos/131/

u =y[x,t];Timing[result=NDSolve[{(∂_(t,t))u==(∂_(x,x))u,y[x,0]==0.1 (1-((Abs[x])/π)),y[π,t]==0,y[-π,t]==0,((∂_t)u/.t->0)==0},y,{t,0,14},{x,-π,π},PrecisionGoal->2,AccuracyGoal->2]]

ListAnimate[Table[Plot[y[x,t]/.result,{x,-π,π},PlotRange->{-.1,.1}],{t,0,14,.1}]]

initPositions={{2,1},{-1,1},{-2,-1},{1,-3},{0,0}};
initVelocities={{0,-.5},{-1,-1},{1,0},{.5,0},{-.2,.4}};
n=Length[initPositions];
G=1 (*Gravitational Constant*);
m={1,1,1,1,2} (*Masses of Bodies*);
Timing[solng=NDSolve[Flatten[{Table[p[k]''[t]==(∑_(i=1)^n)If[i≠k,((G m[[i]](p[i][t]-p[k][t]))/((Norm[p[i][t]-p[k][t]])^3)),0],{k,1,n}],Table[p[i][0]==initPositions[[i]],{i,1,n}],Table[p[i]'[0]==initVelocities[[i]],{i,1,n}]}],Table[p[i][t],{i,1,n}],{t,0,70},MaxSteps->50000];]

graphs=Table[Graphics[Table[{Hue[i/n],Disk[p[i][t],m[[i]]/3]},{i,1,n}]/.solng,PlotRange->{{-10,10},{-10,10}},Axes->False,AspectRatio->Automatic],{t,0,55,.1}];
ListAnimate[graphs]

z