Exemplo n.º 1
0
 public double exchsfq(double s1, double s2, double time1, double time2, double q) {
   typeop = 1;
   sv1 = s1;
   sv2 = s2;
   params(s1, s2, time1, time2, q);
   double m1 = Bivnorm.bivar_params.evalArgs(d3, y2, -Math.sqrt(t1 / t2));
   double m2 = Bivnorm.bivar_params.evalArgs(d4, y1, -Math.sqrt(t1 / t2));
   double n = p.ncDisfnc(d3);
   double c =
       (s2 * Math.exp((b2 - r) * t2) * m1
           - s1 * Math.exp((b1 - r) * t2) * m2
           + qval * s2 * Math.exp((b2 - r) * t1) * n);
   return c;
 }
Exemplo n.º 2
0
 private double N(double x) {
   Probnormal p = new Probnormal();
   double ret = x > (6.95) ? 1.0 : x < (-6.95) ? 0.0 : p.ncDisfnc(x);
   // restrict the range of cdf values to stable values
   return ret;
 }