//======================================================
// Numerical Analysis package in java
// example to show differential equation solution
// Runge-Kutta-Verner variable step method
// Dr. Turhan Coban
// =====================================================
// dy/dx=f(x,y)
// Multiequation method with error correction
import java.io.*;

class fm1 extends f_xi
{
//multivariable function
 double func(double x[],int x_ref)
 {
   //x[0] is x, x[1] is y
   if(x_ref==0) return x[2];
   if(x_ref==1) return 10-10.0*x[1]-11*x[2];
   else return 0;
 }
}

class fm2 extends f_x
{// gerçek çözüm
 public double func(double t)
 {return 1.0-10.0/9.0*Math.exp(-t)+1.0/9.0*Math.exp(-10.0*t);}
}

class NA94B
{

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

  fm1 b1=new fm1();
  fm2 b2=new fm2();
  double y[];
  y=new double[2];
  y[0]=0;
  y[1]=0;
  double a[][]=NA92B.RKV8(b1,0.0,0.2,y,0.005,1e-3);
  Text.print(Text.T(a));
  Plot pp=new Plot(a);
  pp.addFunction(b2,0.0,0.2,20);
  pp.addSpline(2,100);
  pp.setPlotType(2,33);
  pp.plot();
 }
}
