//======================================================
// 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
{
 double func(double x[],int x_ref)
 {
   if(x_ref==0) return x[1]-x[1]*x[2];
   else  return -x[2]+x[1]*x[2];
 }
}

class diferansiyel3G
{

public static void main(String args[]) throws IOException
  {
  fm1 b1=new fm1();
  double y[];
  y=new double[2];
  y[0]=4.0;
  y[1]=1.0;
  double a[][]=diferansiyel3.RK6(b1,0.0,4.0,y,1000);
  Plot p1=new Plot(a[1],a[2]);
  /*
  y[0]=3.5;
  a=diferansiyel3.RK6(b1,0.0,8.0,y,1000);
  p1.addData(a[1],a[2]);
  y[0]=3.0;
  a=diferansiyel3.RK6(b1,0.0,8.0,y,1000);
  p1.addData(a[1],a[2]);
  y[0]=2.5;
  a=diferansiyel3.RK6(b1,0.0,8.0,y,1000);
  p1.addData(a[1],a[2]);
  y[0]=2.0;
  a=diferansiyel3.RK6(b1,0.0,8.0,y,1000);
  p1.addData(a[1],a[2]);
  y[0]=1.5;
  a=diferansiyel3.RK6(b1,0.0,8.0,y,1000);
  p1.addData(a[1],a[2]);
  y[0]=1.0;
  a=diferansiyel3.RK6(b1,0.0,8.0,y,1000);
  p1.addData(a[1],a[2]);
  */
  p1.setXlabel("x");
  p1.setYlabel("y");
  p1.setPlabel("z=f(x,y)");
  p1.setMinMax(0,4.0,0,4.0);
  p1.plot();
 }
}
