Package com.nr.interp

Examples of com.nr.interp.Poly_interp


   * @return
   */
  public static double qromo(final Midpnt q, final double eps) {
    final int JMAX=14, JMAXP=JMAX+1, K=5;
    double[] h = new double[JMAXP],s = new double[JMAX];
    Poly_interp polint = new Poly_interp(h,s,K);
    h[0]=1.0;
    for (int j=1;j<=JMAX;j++) {
      s[j-1]=q.next();
      if (j >= K) {
        double ss=polint.rawinterp(j-K,0.0);
        if (abs(polint.dy) <= eps*abs(ss)) return ss;
      }
      h[j]=h[j-1]/9.0;
    }
    throw new IllegalArgumentException("Too many steps in routine qromo");
View Full Code Here


   * @return
   */
  public static double qromb(final UniVarRealValueFun func, final double a, final double b, final double eps) {
    final int JMAX=20, JMAXP=JMAX+1, K=5;
    double[] s = new double[JMAX],h = new double[JMAXP];
    Poly_interp polint = new Poly_interp(h,s,K);
    h[0]=1.0;
    Trapzd t = new Trapzd(func,a,b);
    for (int j=1;j<=JMAX;j++) {
      s[j-1]=t.next();
      if (j >= K) {
        double ss=polint.rawinterp(j-K,0.0);
        if (abs(polint.dy) <= eps*abs(ss)) return ss;
      }
      h[j]=0.25*h[j-1];
    }
    throw new IllegalArgumentException("Too many steps in routine qromb");
View Full Code Here

    for (j=0;j<MPOL;j++,nn++) {
      cpol[j]=data[2*nn-2];
      spol[j]=data[2*nn-1];
      xpol[j]=nn;
    }
    cdft = new Poly_interp(xpol,cpol,MPOL).interp(en);
    sdft = new Poly_interp(xpol,spol,MPOL).interp(en);
    Fourier.dftcor(w,delta,a,b,endpts,corre,corim,corfac);    // Now get the endpoint correction and the multiplicative
    cdft *= corfac.val;                                                         // factor W(θ)
    sdft *= corfac.val;
    cdft += corre.val;
    sdft += corim.val;
View Full Code Here

    for (i=0;i<N;i++) {
      x[i]=(double)(i)/(N-1);
      y[i]=1.0+x[i]*(1.0+x[i]*(1.0+x[i]*(1.0+x[i])));
    }
    Ran myran = new Ran(17);
    Poly_interp z = new Poly_interp(x,y,3);
    for (i=0;i<N;i++) {
      xx[i]=myran.doub();
      yy[i]=z.interp(xx[i]);    // interpolated values
      dyy[i]=z.dy;        // Estimated errors
      zz[i]=1.0+xx[i]*(1.0+xx[i]*(1.0+xx[i]*(1.0+xx[i])))// Actual Values
    }
    System.out.printf("     Poly_interp: Max. estimated error: %f\n", maxel(dyy));
    System.out.printf("     Poly_interp: Max. actual error:    %f\n", maxel(vecsub(zz,yy)));
View Full Code Here

TOP

Related Classes of com.nr.interp.Poly_interp

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.