//======================================================
// Numerical Analysis package in java
// example to show differential equation solution
// and differentiation (derivative) functions
// Dr. Turhan Coban
// =====================================================
import java.io.*;


class fm1 extends f_xi
{
//Sönümlü harmonik hareket
 double b=0.5;
 double w=3.0;
 // d^2y/dt^2+b*dy/dt+w^2y=0
 double func(double x[],int x_ref)
 {
   //x[0] is x, x[1] is y
   if(x_ref==0) return x[2];
   else  return -b*x[2]-w*w*x[1];
 }
}

class diferansiyel3E
{

public static void main(String args[]) throws IOException
  {

  fm1 b1=new fm1();
  double y[];
  y=new double[3];
  y[0]=0.0;
  y[1]=1.0;
  double a[][]=diferansiyel3.RK6(b1,0.0,40.0,y,10000);
  Plot p1=new Plot(a[1],a[2]);
  p1.setXlabel("y");
  p1.setYlabel("dy/dt");
  p1.setPlabel("Sönümlü harmonik hareket");
  p1.plot();
  Plot p2=new Plot(a[0],a[1]);
  p2.setXlabel("t");
  p2.setYlabel("y");
  p2.setPlabel("Sönümlü harmonik hareket");
  p2.plot();
 }
}
