Examples of Cauchydev


Examples of com.nr.ran.Cauchydev

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

    // Check fingerprint of doub()
    mu=0.0;
    sig=1.0;
    Cauchydev myran = new Cauchydev(mu,sig,17);
    localflag=false;
    for (i=0;i<10;i++) {
      //System.out.printf("%.20f    %.20f\n", myran.dev(), fingerprint[i]);
      localflag=localflag || abs(myran.dev()-fingerprint[i])>sbeps;
    }
    globalflag = globalflag || localflag;
    if (localflag) {
      // fail("*** Cauchydev: dev() does not match fingerprint");
     
    }

    // Check statistics
    Cauchydist expect = new Cauchydist(mu,sig);
    xl=mu-range/2.0;
    xu=mu+range/2.0;
    binsize=range/(M);
    for (i=0;i<M;i++) {
      x[i]=xl+binsize*i;
      ebins[i]=(N)*binsize*expect.p(x[i]+0.5*binsize);
      bins[i]=0;
    }
    for (i=0;i<N;i++) {
      nbin=(int)(floor((0.5*range+myran.dev())/binsize));
      if ((nbin >= 0) && (nbin < M)) bins[nbin] += 1;
    }
    chsone(bins,ebins,df,chisq,prob);
    System.out.printf("     chisq,dev(): %f  prob: %f\n",chisq.val, prob.val);
    localflag = (prob.val < 0.05);
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.