Package org.jquantlib.math.functions

Examples of org.jquantlib.math.functions.Constant


            fail(sb.toString());
        }
    }

    private void testSeveral(final Integrator I) {
        testSingle(I, "f(x) = 1",      new Constant(1.0),               0.0, 1.0, 1.0);
        testSingle(I, "f(x) = x",      new Identity(),                  0.0, 1.0, 0.5);
        testSingle(I, "f(x) = x^2",    new Square(),                    0.0, 1.0, 1.0/3.0);
        testSingle(I, "f(x) = sin(x)", new Sin(),                       0.0, Constants.M_PI, 2.0);
        testSingle(I, "f(x) = cos(x)", new Cos(),                       0.0, Constants.M_PI, 0.0);
        testSingle(I, "f(x) = Gaussian(x)", new NormalDistribution(), -10.0, 10.0, 1.0);
View Full Code Here


    public double shortfall(final double target){
        if (statistics.getSampleSize()==0)
            throw new IllegalArgumentException(empty_sample_set);

        final Ops.DoublePredicate less = new Bind2ndPredicate(new LessThanPredicate(), target);
        return statistics.expectationValue(new Clipped(less, new Constant(1.0)), new TruePredicate()).getFirst();
    }
View Full Code Here

   */
  public /*@Real*/ double shortfall(final /*@Real*/ double target) /*@ReadOnly*/ {
    QL.ensure(samples() != 0, EMPTY_SAMPLE_SET);

    final Ops.DoublePredicate less = new Bind2ndPredicate(new LessThanPredicate(), target);
    return expectationValue(new Clipped(less, new Constant(1.0)), new TruePredicate()).first();
  }
View Full Code Here

            fail(sb.toString());
        }
    }

    private void testSeveral(final Integrator I) {
        testSingle(I, "f(x) = 1",      new Constant(1.0),               0.0, 1.0, 1.0);
        testSingle(I, "f(x) = x",      new Identity(),                  0.0, 1.0, 0.5);
        testSingle(I, "f(x) = x^2",    new Square(),                    0.0, 1.0, 1.0/3.0);
        testSingle(I, "f(x) = sin(x)", new Sin(),                       0.0, Constants.M_PI, 2.0);
        testSingle(I, "f(x) = cos(x)", new Cos(),                       0.0, Constants.M_PI, 0.0);
        testSingle(I, "f(x) = Gaussian(x)", new NormalDistribution(), -10.0, 10.0, 1.0);
View Full Code Here

    QL.info("::::: "+this.getClass().getSimpleName()+" :::::");
  }

  @Test
  public void testPolynomials() {
    checkSingleTabulated(new Constant(1.0), "f(x)=1", 2.0, 1.0e-13);
    checkSingleTabulated(new Identity(), "f(x)=x", 0.0, 1.0e-13);
    checkSingleTabulated(new Square(), "f(x)=x^2", 2.0/3.0, 1.0e-13);
    checkSingleTabulated(new Cube(), "f(x)=x^3", 0.0, 1.0e-13);
    checkSingleTabulated(new Fourth(), "f(x)=x^4", 2.0/5.0, 1.0e-13);
  }
View Full Code Here

    QL.info("::::: "+this.getClass().getSimpleName()+" :::::");
  }

  @Test
  public void testPolynomials() {
    checkSingleTabulated(new Constant(1.0), "f(x)=1",   2.0,     1.0e-13);
    checkSingleTabulated(new Identity(),    "f(x)=x",   0.0,     1.0e-13);
    checkSingleTabulated(new Square(),         "f(x)=x^2", 2.0/3.0, 1.0e-13);
    checkSingleTabulated(new Cube(),        "f(x)=x^3", 0.0,     1.0e-13);
    checkSingleTabulated(new Fourth(),      "f(x)=x^4", 2.0/5.0, 1.0e-13);
  }
View Full Code Here

TOP

Related Classes of org.jquantlib.math.functions.Constant

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.