Package com.nr.fe

Examples of com.nr.fe.Ratfn


   

    // Test Ratfn
    System.out.println("Testing Ratfn: constructor #1");
    Ratfn rp1 = new Ratfn(bb,cc);
    for (i=0;i<M;i++) {
      x=-4.5+i;
      y[i]=rp1.get(x);
      yy[i]=(3.0/2.0)*pow(x-1.0,2);
    }
    System.out.printf("Ratfn: Maximum discrepancy = %f\n", maxel(vecsub(y,yy)));
    localflag = maxel(vecsub(y,yy)) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Ratfn: Rational function returns incorrect values");
     
    }

    System.out.println("Testing Ratfn: constructor #2");
    Ratfn rp2= new Ratfn(dd,6,4);
    for (i=0;i<M;i++) {
      x=-4.5+i;
      y[i]=rp2.get(x);
      yy[i]=(3.0/2.0)*pow(x-1.0,2);
    }
    System.out.printf("Ratfn: Maximum discrepancy = %f\n", maxel(vecsub(y,yy)));
    localflag = maxel(vecsub(y,yy)) > sbeps;
    globalflag = globalflag || localflag;
View Full Code Here


    fac=1.0;
    for (i=0;i<2*M;i++) {     // Series coefficients
      c[i]=fac/(double)(i+1);
      fac = -fac;
    }
    Ratfn q=Ratfn.ratlsq(this,0.0,2.0,M,M,dev); // Diagonal works best for this function
    for (i=0;i<N;i++) {
      x=0.2*(double)(i);
      y[i]=funk(x)// Function values
      yy[i]=q.get(x);     // Rational function
    }
    System.out.printf("ratlsq: Maximum error of ratlsq rational function approximation = %f\n", maxel(vecsub(y,yy)));
    localflag = maxel(vecsub(y,yy)) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
View Full Code Here

    for (i=0;i<M;i++) {
      c[i]=fac/(double)(i+1);
      fac = -fac;
    }
    double[] cc = buildVector(c);
    Ratfn r=Ratfn.pade(cc);
    for (i=0;i<N;i++) {
      x=0.2*(double)(i);
      y[i]=Func_pade(x);
      yy[i]=r.get(x);
      val=c[M-1];
      for (j=M-2;j>=0;j--) {
        val=val*x+c[j];
      }
      yyy[i]=val;
View Full Code Here

TOP

Related Classes of com.nr.fe.Ratfn

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.