Package com.nr.sf

Examples of com.nr.sf.Bessjy


//    for (i=0;i<N;i++) System.out.printf(x[i] << "  ";
//    System.out.printf(endl;

    // Calculate some function values and derivatives
    Ran myran=new Ran(14);
    Bessjy bess=new Bessjy();
    for (i=0;i<N;i++) {
      y=x[0]*(2.0*myran.doub()-1.0);
      Weights.weights(y,x,c);
      // Calculate function
      f=f1=f2=0;
      for (j=0;j<N;j++) {
        f += c[j][0]*bess.jn(5,x[j]);
        f1 += c[j][1]*bess.jn(5,x[j]);
        f2 += c[j][2]*bess.jn(5,x[j]);
      }
//      System.out.printf(y);
//      System.out.printf(abs(bess.jn(5,y)-f) << " ";
//      System.out.printf(abs(0.5*(bess.jn(4,y)-bess.jn(6,y))-f1) << " ";
//      System.out.printf(abs(0.25*(bess.jn(3,y)-2.0*bess.jn(5,y)+bess.jn(7,y))-f2));

      sbeps=1.e-3;
      localflag = abs(bess.jn(5,y)-f) > sbeps;
      globalflag = globalflag || localflag;
      if (localflag) {
        fail("*** weights: Evaluation of function was inaccurate");
       
      }

      sbeps=1.e-3;
      localflag = abs(0.5*(bess.jn(4,y)-bess.jn(6,y))-f1) > sbeps;
      globalflag = globalflag || localflag;
      if (localflag) {
        fail("*** weights: Evaluation of first derivative was inaccurate");
       
      }

      sbeps=1.e-3;
      localflag = abs(0.25*(bess.jn(3,y)-2.0*bess.jn(5,y)+bess.jn(7,y))-f2) > sbeps;
      globalflag = globalflag || localflag;
      if (localflag) {
        fail("*** weights: Evaluation of second derivative was inaccurate");
       
      }
View Full Code Here


    if (globalflag) System.out.println("Failed\n");
    else System.out.println("Passed\n");
  }
  class Func_Amoeba implements RealValueFun {
    public double funk(final double[] x) {
    Bessjy b = new Bessjy();
    return(b.j0(x[0])+pow(x[1],2.0));
    }
View Full Code Here

    return(b.j0(x[0])+pow(x[1],2.0));
    }
  }
  class Bessj1_Amoeba implements UniVarRealValueFun {
    public double funk(final double x) {
    Bessjy b = new Bessjy();
    return(b.j1(x));
  }
View Full Code Here

   

    // Test StepperBS
    System.out.println("Testing StepperBS");

    Bessjy bess = new Bessjy();
    for (i=0;i<nvar;i++) {
      y[i]=bess.jn(i,x1);
      yexp[i]=bess.jn(i,x2);
    }
    Output out=new Output(20);
    rhs_StepperBS d = new rhs_StepperBS();
    StepperBS s = new StepperBS();
    Odeint ode = new Odeint(y,x1,x2,atol,rtol,h1,hmin,out,d,s);
View Full Code Here

  public double funk(double[] x) {
    return Bessj0_Powell(x);
  }
 
  double Bessj0_Powell(double[] x) {
    Bessjy b = new Bessjy();
    return(b.j0(sqrt(SQR(x[0])+SQR(x[1])+SQR(x[2]))));
  }
View Full Code Here

    if (globalflag) System.out.println("Failed\n");
    else System.out.println("Passed\n");
  }
 
  public double funk(final double x) {
    Bessjy b = new Bessjy();
    return(b.j0(x));
  }
View Full Code Here

    System.out.println("Testing rk4");

    x=1.0;
    h=0.1;

    Bessjy bess=new Bessjy();
    for (i=0;i<nvar;i++) {
      y[i]=bess.jn(i,x);
      yexp[i]=bess.jn(i,x+h);
    }

    rk4_derivs(x,y,dydx);
    RK4_derivs rk4_derivs = new RK4_derivs();
    Odeint.rk4(y,dydx,x,h,yout,rk4_derivs);
View Full Code Here

   

    // Test StepperDopr5
    System.out.println("Testing StepperDopr5");

    Bessjy bess = new Bessjy();
    for (i=0;i<nvar;i++) {
      y[i]=bess.jn(i,x1);
      yexp[i]=bess.jn(i,x2);
    }
    Output out = new Output(20);
    rhs_StepperDopr5 d = new rhs_StepperDopr5();
    StepperDopr5 s = new StepperDopr5();
    Odeint ode = new Odeint(y,x1,x2,atol,rtol,h1,hmin,out,d,s);
View Full Code Here

    if (globalflag) System.out.println("Failed\n");
    else System.out.println("Passed\n");
  }
 
  public double funk(final double[] x) {
    Bessjy b = new Bessjy();
    return(b.j0(sqrt(SQR(x[0])+SQR(x[1])+SQR(x[2]))));
  }
View Full Code Here

    }
  };

  class bj0_dfridr implements UniVarRealValueFun{
    public double funk(final double x) {
    Bessjy b = new Bessjy();
    return(b.j0(x));
  }
View Full Code Here

TOP

Related Classes of com.nr.sf.Bessjy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.