class Simulation implements Runnable{ private DrawSim plot; private Hyperion oneD; private double told,tnew,var[],new_var[]; private double TIMESTEP=0.01; private int M=6; private double T=10.0; private double GM=39.489,v=6.284; private int NSTEPS; Simulation(DrawSim plotting, Hyperion oneDlocal){ oneD=oneDlocal; plot=plotting; NSTEPS=(int)(T/TIMESTEP); var = new double[M]; new_var = new double[M]; } public void setV(double z){ v=z; } public void run(){ int i,j; while(true){ oneD.runner.suspend(); plot.clearScreen(); // initial conditions told=0.0; var[0]=1.0; var[1]=0.0; var[2]=0.0; var[3]=v; var[4]=0.0; var[5]=0.0; for(i=0;i<=NSTEPS;i++){ // update coords using runge-kutta tnew=told+TIMESTEP; rk4(var,new_var,told,TIMESTEP); // plot new point on trajectory plot.addXToScreen(tnew,var[4]); plot.addVToScreen(tnew,var[5]); told=tnew; if(new_var[4]>3.14159265) new_var[4]=new_var[4]-2*3.14159265; if(new_var[4]<-3.14159265) new_var[4]=new_var[4]+2*3.14159265; for(j=0;j