import java.io.*;

class fm1 extends f_xi
{
//Spring-mass system
double m,k;
 public fm1(double mi,double ki)
 {m=mi;k=ki;}
 double func(double x[],int x_ref)
 {  double P;
    if(x[0]<2) P=10*x[0];
    else P=20;
   //x[0] is t, x[1] is teta(pendulum swing angle) x[2] v velocity
   if(x_ref==0) return x[2];
   else return P/m-k/m*x[1];
 }
}


class NA137
{

public static void main(String args[]) throws IOException
{
  fm1 b1=new fm1(2.5,75.0);
  double y[];
  y=new double[2];
  y[0]=0.0;
  y[1]=1.0;
  double a[][]=NA93.RK6(b1,0.0,10.0,y,100000);
  int n=a[0].length;
  Plot p1=new Plot(a[0],a[1]);
  p1.setXlabel("time, t");
  p1.setYlabel("y");
  p1.setPlabel("spring-mass system");
  p1.plot();
 }

}
