Package com.nr.fi

Examples of com.nr.fi.Midinf


    // integral of distribution is one
    sbeps=1.e-8;
    df=100.;
    func_Chisqdist dist = new func_Chisqdist(df);
    Midpnt q2=new Midpnt(dist,0.0,4.0);
    Midinf q3=new Midinf(dist,4.0,1.0e99);
    integral=qromo(q2)+qromo(q3);
    localflag = abs(1.0-integral) > sbeps;
//    System.out.printf(setprecision(15) << 1.0-integral);
    globalflag = globalflag || localflag;
    if (localflag) {
View Full Code Here


    // integral of distribution is one
    sbeps=5.e-8;
    m=0.5; s=1.5;
    func_Lognormaldist dist= new func_Lognormaldist(m,s);
    Midpnt q2 = new Midpnt(dist,0.0,10.0);
    Midinf q3 = new Midinf(dist,10.0,1.0e99);
    integral=qromo(q2)+qromo(q3);
    localflag = abs(1.0-integral) > sbeps;
//    System.out.printf(setprecision(15) << 1.0-integral);
    globalflag = globalflag || localflag;
    if (localflag) {
View Full Code Here

    // integral of distribution is one
    sbeps=1.e-8;
    m=1.0;s=2.0;
    func_Cauchydist dist=new func_Cauchydist(m,s);
    Midinf q1 = new Midinf(dist,-1.0e99,-1.0);
    Midpnt q2 = new Midpnt(dist,-1.0,1.0);
    Midinf q3 = new Midinf(dist,1.0,1.0e99);
    integral=qromo(q1)+qromo(q2)+qromo(q3);
    localflag = abs(1.0-integral) > sbeps;
//    System.out.printf(setprecision(15) << 1.0-integral);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Cauchydist: Distribution is not normalized to 1.0");
     
    }

    // cdf agrees with incomplete integral
    sbeps=1.e-7;
    m=0.5;s=1.5;
    func_Cauchydist dist2=new func_Cauchydist(m,s);
    Cauchydist normcdf = new Cauchydist(m,s);
    localflag=false;
    for (i=0;i<N;i++) {
      if (x[i] < 0.0) {
        q1 = new Midinf(dist2,-1.e99,x[i]);
        integral=qromo(q1);
      } else {
        q1 = new Midinf(dist2,-1.e99,-1.0);
        q2 = new Midpnt(dist2,-1.0,x[i]);
        integral=qromo(q1)+qromo(q2);
      }
      c[i]=integral;
      d[i]=normcdf.cdf(x[i]);
View Full Code Here

    // integral of distribution is one
    sbeps=1.e-8;
    beta=1.5;
    func_Expondist dist =new func_Expondist(beta);
    Midpnt q2 = new Midpnt(dist,0.0,4.0);
    Midinf q3 = new Midinf(dist,4.0,1.0e99);
    integral=qromo(q2)+qromo(q3);
    localflag = abs(1.0-integral) > sbeps;
//    System.out.printf(setprecision(15) << 1.0-integral);
    globalflag = globalflag || localflag;
    if (localflag) {
View Full Code Here

    // integral of distribution is one
    sbeps=1.e-8;
    m=1.0;s=2.0;
    func_Logisticdist dist = new func_Logisticdist(m,s);
    Midinf q1 = new Midinf(dist,-1.0e99,-1.0);
    Midpnt q2 = new Midpnt(dist,-1.0,1.0);
    Midinf q3 = new Midinf(dist,1.0,1.0e99);
    integral=qromo(q1)+qromo(q2)+qromo(q3);
    localflag = abs(1.0-integral) > sbeps;
//    System.out.printf(setprecision(15) << 1.0-integral);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Logisticdist: Distribution is not normalized to 1.0");
     
    }

    // cdf agrees with incomplete integral
    sbeps=1.e-7;
    m=0.5;s=1.5;
    func_Logisticdist dist2 = new func_Logisticdist(m,s);
    Logisticdist normcdf = new Logisticdist(m,s);
    localflag=false;
    for (i=0;i<N;i++) {
      if (x[i] < 0.0) {
        q1 = new Midinf(dist2,-1.e99,x[i]);
        integral=qromo(q1);
      } else {
        q1 = new Midinf(dist2,-1.e99,-1.0);
        q2 = new Midpnt(dist2,-1.0,x[i]);
        integral=qromo(q1)+qromo(q2);
      }
      c[i]=integral;
      d[i]=normcdf.cdf(x[i]);
View Full Code Here

    // integral of distribution is one
    sbeps=5.e-7;
    nu1=5.0; nu2=5.0;
    func_Fdist dist = new func_Fdist(nu1,nu2);
    Midpnt q2 = new Midpnt(dist,0.0,10.0);
    Midinf q3 = new Midinf(dist,10.0,1.0e99);
    integral=qromo(q2)+qromo(q3);
    localflag = abs(1.0-integral) > sbeps;
//    System.out.printf(setprecision(15) << 1.0-integral);
    globalflag = globalflag || localflag;
    if (localflag) {
View Full Code Here

    // integral of distribution is one
    sbeps=2.e-7;
    alpha=2.5; beta=1.5;
    func_Gammadist dist = new func_Gammadist(alpha,beta);
    Midpnt q2 = new Midpnt(dist,0.0,2.0);
    Midinf q3 = new Midinf(dist,2.0,1.0e99);
    integral=qromo(q2)+qromo(q3);
    localflag = abs(1.0-integral) > sbeps;
//    System.out.printf(setprecision(15) << 1.0-integral);
    globalflag = globalflag || localflag;
    if (localflag) {
View Full Code Here

    // integral of distribution is one
    sbeps=1.e-10;
    n=2.0;m=1.0;s=2.0;
    func_Studenttdist dist = new func_Studenttdist(n,m,s);
    Midinf q1 = new Midinf(dist,-1.0e99,-1.0);
    Midpnt q2 = new Midpnt(dist,-1.0,1.0);
    Midinf q3 = new Midinf(dist,1.0,1.0e99);
    integral=qromo(q1)+qromo(q2)+qromo(q3);
    localflag = abs(1.0-integral) > sbeps;
//    System.out.printf(setprecision(15) << 1.0-integral);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Studenttdist: Distribution is not normalized to 1.0");
     
    }

    // cdf agrees with incomplete integral
    sbeps=1.e-8;
    n=2.0;m=0.5;s=1.5;
    func_Studenttdist dist2 = new func_Studenttdist(n,m,s);
    Studenttdist normcdf = new Studenttdist(n,m,s);
    localflag=false;
    for (i=0;i<N;i++) {
      if (x[i] < 0.0) {
        q1 = new Midinf(dist2,-1.e99,x[i]);
        integral=qromo(q1);
      } else {
        q1 = new Midinf(dist2,-1.e99,-1.0);
        q2 = new Midpnt(dist2,-1.0,x[i]);
        integral=qromo(q1)+qromo(q2);
      }
      c[i]=integral;
      d[i]=normcdf.cdf(x[i]);
View Full Code Here

    expect=sqrt(PI)/2.0/exp(1.0);

    a=-INFTY;
    b=-1.0;
    func_midinf1 func_midinf1 =new func_midinf1();
    Midinf midinf1 = new Midinf(func_midinf1,a,b);
    s1=qromo(midinf1);

    System.out.printf("midinf,case 1: Maximum discrepancy = %f\n", abs(s1-expect));
    localflag = abs(s1-expect) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** midinf,case 1: Failure to achieve expected accuracy in improper integral");
     
    }

    a=1.0;
    b=INFTY;
    func_midinf2 func_midinf2 = new func_midinf2();
    Midinf midinf2 = new Midinf(func_midinf2,a,b);
    s2=qromo(midinf2);

    System.out.printf("midinf,case 2: Maximum discrepancy = %f\n", abs(s2-expect));
    localflag = abs(s2-expect) > sbeps;
    globalflag = globalflag || localflag;
View Full Code Here

TOP

Related Classes of com.nr.fi.Midinf

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.