Package com.nr

Examples of com.nr.Complex.mul()


     
      //res1=(cc-2.0*aa-(bb-aa)*zz)*hypgeo(aa,bb,cc,zz)
      //  + aa*(1.0-zz)*hypgeo(aa+1.0,bb,cc,zz);
      Complex r = bb.sub(aa).mul(zz);
      r = cc.sub(aa.mul(2.0)).sub(r);
      r = r.mul(hypgeo(aa,bb,cc,zz));
      res1 = r.add( aa.mul(new Complex(1.0).sub(zz)).mul(
          hypgeo(aa.add(new Complex(1.0)),bb,cc,zz)) );
     
      //res2=(cc-aa)*hypgeo(aa-1.0,bb,cc,zz);
      //      System.out.printf(abs(res1-res2));
View Full Code Here


          hypgeo(aa.add(new Complex(1.0)),bb,cc,zz)) );
     
      //res2=(cc-aa)*hypgeo(aa-1.0,bb,cc,zz);
      //      System.out.printf(abs(res1-res2));
      r = cc.sub(aa);
      res2 = r.mul(hypgeo(aa.sub(new Complex(1.0)),bb,cc,zz));
      localflag = localflag || res1.sub(res2).abs() > sbeps;
     
    }
    globalflag = globalflag || localflag;
    if (localflag) {
View Full Code Here

      aa=new Complex(-0.5,-5.0+0.1*i);
      bb=new Complex(1.0,0.0);
      cc=new Complex(-0.5,-5.0+0.1*i);
      zz=new Complex(-5.0+0.1*i,-5.0+0.1*i);
      Complex r = cc.mul(2.0).sub(aa).sub(bb).sub(new Complex(1.0));
      r = cc.sub(new Complex(1.0)).sub(r.mul(zz));
      r = cc.mul(r).mul(hypgeo(aa,bb,cc,zz));
      Complex rr =(cc.sub(aa)).mul(cc.sub(bb)).mul(zz).mul(hypgeo(aa,bb,cc.sub(new Complex(1.0)),zz));
      res1 = r.add(rr);
      //res1=cc*(cc-1.0-(2.0*cc-aa-bb-1.0)*zz)*hypgeo(aa,bb,cc,zz)
      //  + (cc-aa)*(cc-bb)*zz*hypgeo(aa,bb,cc+1.0,zz);
 
View Full Code Here

    dyds[0]=y[1].mul(dz);
    //dyds[1]=(a*b*y[0]-(c-(a+b+1.0)*z)*y[1])*dz/(z*(1.0-z));
   
    Complex aa = c.sub((a.add(b).add(new Complex(1,0))).mul(z));
    Complex bb = a.mul(b).mul(y[0]).sub(aa.mul(y[1]));
    dyds[1]=bb.mul(dz).div(z.mul(new Complex(1.0,0).sub(z)));
   
    dyyds[0]=dyds[0].re();
    dyyds[1]=dyds[0].im();
    dyyds[2]=dyds[1].re();
    dyyds[3]=dyds[1].im();
View Full Code Here

        a= -i*i;
        b = b.add(new Complex(2.0,0));
        d= new Complex(1.0,0).div(new Complex(a,0).mul(d).add(b)); // d=1.0/(a*d+b);
        c=b.add(new Complex(a,0).div(c)); // c=b+a/c;
        del=c.mul(d);
        h = h.mul(del);
        if (abs(del.re()-1.0)+abs(del.im()) <= EPS) break;
      }
      if (i >= MAXIT) throw new IllegalArgumentException("cf failed in cisi");
      h=new Complex(cos(t),-sin(t)).mul(h);
      //cs= -conj(h)+Complex(0.0,PIBY2);
View Full Code Here

    sbeps=1.e-13;
    ncount=0;   // Count roots outside unit circle
    for (i=0;i<NPOLES;i++) {
      z1=zeros[i].sub(new Complex(0.5,0))// compute (z-1/2)^6=1.0
      z2=z1.mul(z1).mul(z1);
      z1=z2.mul(z2);
      //System.out.printf(setprecision(18) << abs(z1-Complex(1.0,0.0)));
      localflag = z1.sub(new Complex(1.0,0.0)).abs() > sbeps;
      //System.out.printf(abs(zeros[i]));
      if (zeros[i].abs() > 1.0) ncount++;
      globalflag = globalflag || localflag;
View Full Code Here

    System.out.println("Testing zrhqr");
    // Roots of polynomial 
    zrhqr(aa,rts);
    for (i=0;i<N;i++) {
      b=new Complex(a[5]);
      for (j=0;j<5;j++) b=b.mul(rts[i]).add(new Complex(a[4-j]));
      dy[i]=b.abs();
//      System.out.printf(b << "  %f\n", dy[i]);
    }
    System.out.printf("zrhqr: Maximum discrepancy = %f\n", maxel(dy));
    localflag = maxel(dy) > sbeps;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.