Package com.nr.sf

Examples of com.nr.sf.Bessjy


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


    else System.out.println("Passed\n");
  }

  class  Bessjn_gauher {
    double get(int n,double x) {
      Bessjy b = new Bessjy();
      return(b.jn(n,x));
    }
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

   

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

    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_StepperDopr853 d = new rhs_StepperDopr853();
    StepperDopr853 s = new StepperDopr853();
    Odeint ode = new Odeint(y,x1,x2,atol,rtol,h1,hmin,out,d,s);
View Full Code Here

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

    Bessjy b = new Bessjy();;
    return(b.j0(x));
  }

  double Bessj1_Golden(final double x) {
    Bessjy b = new Bessjy();
    return(b.j1(x));
  }
View Full Code Here

  @Test
  public void test() {
    int i,j,N=5,NN=50,m,MM=11;
    double x,xx,aa=-5.0,bb=5.0,val,thresh=1.e-6,sbeps=1.e-6;
    double[] y = new double[MM],yy = new double[MM];
    Bessjy b = new Bessjy();
    boolean localflag, globalflag=false;

   

    // Test Chebyshev (eval)
    System.out.println("Testing Chebyshev (eval)");
    bjn bjn = new bjn();
    Chebyshev cheb = new Chebyshev(bjn,aa,bb,NN);
    m=cheb.setm(thresh);
    for (i=0;i<MM;i++) {
      x=-5.0+i;
      y[i]=cheb.eval(x,m);
      yy[i]=bjn.funk(x);
    }
    System.out.printf("Chebyshev (eval): Maximum discrepancy = %f\n", maxel(vecsub(y,yy)));
    localflag = maxel(vecsub(y,yy)) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Chebyshev (eval): Chebyshev approximation does not evaluate to accurate function values");
     
    }

    // Test Chebyshev (polycofs)
    System.out.println("Testing Chebyshev (polycofs)");
    double[] d=cheb.polycofs(m);
    for (i=0;i<MM;i++) {
      x=-5.0+(double)(i);
      y[i]=cheb.eval(x,m);
      xx=(x-0.5*(aa+bb))/(0.5*(bb-aa));
      val=d[m-1];
      for (j=m-2;j>=0;j--) val=val*xx+d[j];
      yy[i]=val;
//    System.out.printf(y[i] << " %f\n", yy[i] << endl;
    }
    System.out.printf("Chebyshev (polycofs): Maximum discrepancy = %f\n", maxel(vecsub(y,yy)));
    localflag = maxel(vecsub(y,yy)) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Chebyshev (polycofs): Polynomial coefficients do not yield correct function values");
     
    }

    // Test Chebyshev (derivative)
    System.out.println("Testing Chebyshev (derivative)");
    Chebyshev cder=cheb.derivative();
    for (i=0;i<MM;i++) {
      x=-5.0+i;
      y[i]=cder.eval(x,m);
      yy[i]=0.5*(b.jn(N-1,x)-b.jn(N+1,x));
//      System.out.printf(y[i] << " %f\n", yy[i] << endl;
    }
    System.out.printf("Chebyshev (derivative): Maximum discrepancy = %f\n", maxel(vecsub(y,yy)));
    localflag = maxel(vecsub(y,yy)) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Chebyshev (derivative): Chebyshev derivative has incorrect values");
     
    }

    // Test Chebyshev (integral)
    System.out.println("Testing Chebyshev (integral)");
    bj1 bj1 = new bj1();
    Chebyshev cheb1 = new Chebyshev(bj1,aa,bb,NN);
    Chebyshev cint=cheb1.integral();
    for (i=0;i<MM;i++) {
      x=-5.0+i;
      y[i]=cint.eval(x,m);
      yy[i]=b.j0(aa)-b.j0(x);
//    System.out.printf(y[i] << " %f\n", yy[i] << endl;
    }
    System.out.printf("Chebyshev (integral): Maximum discrepancy = %f\n", maxel(vecsub(y,yy)));
    sbeps=2.0e-6;
    localflag = maxel(vecsub(y,yy)) > sbeps;
View Full Code Here

 
  class bjn implements UniVarRealValueFun{
    public double funk(final double x) {
      int N=5;

      Bessjy b = new Bessjy();
      return(b.jn(N,x));
    }
View Full Code Here

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

    Bessjy b = new Bessjy();
    return(b.j0(x));
  }

  double Bessj1_Brent(final double x) {
    Bessjy b = new Bessjy();
    return(b.j1(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.