//======================================================
// 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
{
//multivariable function
 double sigma=5.0;
 double lambda=28.0;
 double gamma=8.0/3.0;


 double func(double x[],int x_ref)
 {
   //x[0] is x, x[1] is y

   if(x_ref==0) return sigma*(x[2]-x[1]);
   if(x_ref==1) return (1+lambda-x[3])*x[1]-x[2];
   else         return x[1]*x[2]-gamma*x[3];
 }
}

class diferansiyel3B
{

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

  fm1 b1=new fm1();
  double y[];
  y=new double[3];
  y[0]=-0.6;
  y[1]=0.0;
  y[2]=60.0;
  double a[][]=NA92F.RKV16(b1,0.0,40.0,y,10000);
  Plot p1=new Plot(a[1],a[3]);
  p1.setXlabel("x1");
  p1.setYlabel("x3");
  p1.setPlabel("Lorentz attractor");
  p1.plot();
  Plot p2=new Plot(a[0],a[1]);
  p2.setXlabel("x0");
  p2.setYlabel("x3");
  p2.setPlabel("Lorentz equation");
  p2.plot();
 }
}
