Package org.jquantlib.math.distributions

Examples of org.jquantlib.math.distributions.CumulativeNormalDistribution.op()


    final double tolerance = 1.0e-15;

    final CumulativeNormalDistribution cnd = new CumulativeNormalDistribution();

    // assertEquals(0, cnd.evaluate(z),1.0e-15);
    if (Math.abs(0.0-(cnd.op(z)))>tolerance) {
      fail("expected: 1.0" + " but is: " + cnd.op(z));
    }

    z = -10;
    // assertEquals(0, cnd.evaluate(z),1.0e-15);
View Full Code Here


    final CumulativeNormalDistribution cnd = new CumulativeNormalDistribution();

    // assertEquals(0, cnd.evaluate(z),1.0e-15);
    if (Math.abs(0.0-(cnd.op(z)))>tolerance) {
      fail("expected: 1.0" + " but is: " + cnd.op(z));
    }

    z = -10;
    // assertEquals(0, cnd.evaluate(z),1.0e-15);
    if (Math.abs(0.0-cnd.op(z))>tolerance) {
View Full Code Here

      fail("expected: 1.0" + " but is: " + cnd.op(z));
    }

    z = -10;
    // assertEquals(0, cnd.evaluate(z),1.0e-15);
    if (Math.abs(0.0-cnd.op(z))>tolerance) {
      fail("expected: 1.0" + " but is: " + cnd.op(z));
    }

    z = 10;
    // assertEquals(1.0, cnd.evaluate(z),1.0e-15);
View Full Code Here

    }

    z = -10;
    // assertEquals(0, cnd.evaluate(z),1.0e-15);
    if (Math.abs(0.0-cnd.op(z))>tolerance) {
      fail("expected: 1.0" + " but is: " + cnd.op(z));
    }

    z = 10;
    // assertEquals(1.0, cnd.evaluate(z),1.0e-15);
    if (Math.abs(1.0-(cnd.op(z)))>tolerance) {
View Full Code Here

      fail("expected: 1.0" + " but is: " + cnd.op(z));
    }

    z = 10;
    // assertEquals(1.0, cnd.evaluate(z),1.0e-15);
    if (Math.abs(1.0-(cnd.op(z)))>tolerance) {
      fail("expected: 1.0" + " but is: " + cnd.op(z));
    }

    z = 40;
    // assertEquals(1.0, cnd.evaluate(z),1.0e-15);
View Full Code Here

    }

    z = 10;
    // assertEquals(1.0, cnd.evaluate(z),1.0e-15);
    if (Math.abs(1.0-(cnd.op(z)))>tolerance) {
      fail("expected: 1.0" + " but is: " + cnd.op(z));
    }

    z = 40;
    // assertEquals(1.0, cnd.evaluate(z),1.0e-15);
    if (Math.abs(1.0-(cnd.op(z)))>tolerance) {
View Full Code Here

      fail("expected: 1.0" + " but is: " + cnd.op(z));
    }

    z = 40;
    // assertEquals(1.0, cnd.evaluate(z),1.0e-15);
    if (Math.abs(1.0-(cnd.op(z)))>tolerance) {
      fail("expected: 1.0" + " but is: " + cnd.op(z));
    }
  }
}
View Full Code Here

    }

    z = 40;
    // assertEquals(1.0, cnd.evaluate(z),1.0e-15);
    if (Math.abs(1.0-(cnd.op(z)))>tolerance) {
      fail("expected: 1.0" + " but is: " + cnd.op(z));
    }
  }
}
View Full Code Here

            s1d.setMaxEvaluations(1000);

            final double /* @Real */yb = s1d.solve(function, 1e-6, 0.00, -100.0, 100.0);
            final double /* @Real */h1 = (yb - muy_) / (sigmay_ * txy) - rhoxy_ * (x - mux_) / (sigmax_ * txy);
            // not sure if evaluate method is equivalent of op overloading -> we have to test it ;-)
            double /* @Real */value = /* phi(-w_*h1) */phi.op(-w_ * h1);

            for (i = 0; i < size_; i++) {
                final double /* @Real */h2 = h1 + Bb_.get(i) * sigmay_ * Math.sqrt(1.0 - rhoxy_ * rhoxy_);
                final double /* @Real */kappa = -Bb_.get(i)
                * (muy_ - 0.5 * txy * txy * sigmay_ * sigmay_ * Bb_.get(i) + rhoxy_ * sigmay_ * (x - mux_) / sigmax_);
View Full Code Here

            for (i = 0; i < size_; i++) {
                final double /* @Real */h2 = h1 + Bb_.get(i) * sigmay_ * Math.sqrt(1.0 - rhoxy_ * rhoxy_);
                final double /* @Real */kappa = -Bb_.get(i)
                * (muy_ - 0.5 * txy * txy * sigmay_ * sigmay_ * Bb_.get(i) + rhoxy_ * sigmay_ * (x - mux_) / sigmax_);
                // operator overloading problem again
                value -= lambda.get(i) * Math.exp(kappa) * /* phi(-w_*h2) */phi.op(-w_ * h2);
            }

            return Math.exp(-0.5 * temp * temp) * value / (sigmax_ * Math.sqrt(2.0 * Constants.M_PI));
        }

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.