Examples of integrate()


Examples of com.nr.ode.Odeint.integrate()

    h1=(x2-x1)/100.0;
    y=buildVector(load1(x1,v));
    Output out = new Output();
    StepperDopr853 s1 = new StepperDopr853();
    Odeint integ1 = new Odeint(y,x1,xf,atol,rtol,h1,hmin,out,d,s1);
    integ1.integrate();
    f1=buildVector(score(xf,y));
    y=buildVector(load2(x2,v2));
   
    StepperDopr853 s2 = new StepperDopr853();
    Odeint integ2 = new Odeint(y,x2,xf,atol,rtol,h1,hmin,out,d,s2);
View Full Code Here

Examples of com.nr.ode.Odeint.integrate()

    f1=buildVector(score(xf,y));
    y=buildVector(load2(x2,v2));
   
    StepperDopr853 s2 = new StepperDopr853();
    Odeint integ2 = new Odeint(y,x2,xf,atol,rtol,h1,hmin,out,d,s2);
    integ2.integrate();
    f2=buildVector(score(xf,y));
    for (int i=0;i<nvar;i++) f1[i] -= f2[i];
    return f1;
  }
 
View Full Code Here

Examples of com.nr.ode.Odeint.integrate()

    h1=(x2-x1)/100.0;
    y=load(x1,v);
    Output out = new Output();
    StepperDopr853 s = new StepperDopr853();
    Odeint integ = new Odeint(y,x1,x2,atol,rtol,h1,hmin,out,d, s);
    integ.integrate();
    return score(x2,y);
  }
 
  public abstract double[] load(final double x, final double[] v);
 
View Full Code Here

Examples of com.nr.ode.Odeint.integrate()

    }
    Output out=new Output(20);
    rhs_StepperDopr853 d = new rhs_StepperDopr853();
    StepperDopr853 s = new StepperDopr853();
    Odeint ode = new Odeint(y,x1,x2,atol,rtol,h1,hmin,out,d,s);
    ode.integrate();

    for (i=0;i<nvar;i++) {
      yout[i]=out.ysave[i][out.count-1];
      System.out.printf("%f  %f\n", yout[i],yexp[i]);
    }
View Full Code Here

Examples of com.opengamma.analytics.math.function.PiecewisePolynomialFunction1D.integrate()

    PiecewisePolynomialFunction1D func = new PiecewisePolynomialFunction1D();

    final int nPts = 101;
    for (int i = 0; i < nPts; ++i) {
      final double key = 0. + 5. / (nPts - 1) * i;
      System.out.println(key + "\t" + interpolator.interpolate(xValues, yValues, key) + "\t" + func.integrate(result, 0., key));
    }

    System.out.println("\n");

    for (int i = 0; i < nPts; ++i) {
View Full Code Here

Examples of com.opengamma.analytics.math.integration.IntegratorRepeated2D.integrate()

    final double relativeTolerance = 1.0E-5;
    final RungeKuttaIntegrator1D integrator1D = new RungeKuttaIntegrator1D(absoluteTolerance, relativeTolerance, NB_INTEGRATION);
    final IntegratorRepeated2D integrator2D = new IntegratorRepeated2D(integrator1D);
    double pv = 0.0;
    try {
      pv = 1.0 / (2.0 * Math.PI * Math.sqrt(1 - rhobar * rhobar)) * integrator2D.integrate(integrant, new Double[] {-limit, -limit}, new Double[] {limit, limit});
    } catch (final Exception e) {
      throw new RuntimeException(e);
    }

    return MultipleCurrencyAmount.of(swaption.getCurrency(), dft0 * pv * (swaption.isLong() ? 1.0 : -1.0));
View Full Code Here

Examples of com.opengamma.analytics.math.integration.RungeKuttaIntegrator1D.integrate()

    final double absoluteTolerance = 1.0E-8;
    final double relativeTolerance = 1.0E-9;
    final RungeKuttaIntegrator1D integrator = new RungeKuttaIntegrator1D(absoluteTolerance, relativeTolerance, NB_INTEGRATION);
    double pv = 0.0;
    try {
      pv = 1.0 / Math.sqrt(2.0 * Math.PI) * integrator.integrate(integrant, -limit, limit) * (swaption.isLong() ? 1.0 : -1.0) * notional * dfIbor[0];
    } catch (final Exception e) {
      throw new RuntimeException(e);
    }
    return MultipleCurrencyAmount.of(swaption.getCurrency(), pv);
  }
View Full Code Here

Examples of org.apache.commons.math.analysis.integration.RombergIntegrator.integrate()

    k[k.length - 1] = n - lastJ;

    // now verify probabilities by comparing to integral of pdf
    UnivariateRealIntegrator integrator = new RombergIntegrator();
    for (int i = 0; i < xs.length - 1; i++) {
      double delta = integrator.integrate(new UnivariateRealFunction() {
        public double value(double v) {
          return dist.pdf(v);
        }
      }, xs[i], xs[i + 1]);
      Assert.assertEquals(delta, p[i + 1], 1.0e-6);
View Full Code Here

Examples of org.apache.commons.math.analysis.integration.UnivariateRealIntegrator.integrate()

    k[k.length - 1] = n - lastJ;

    // now verify probabilities by comparing to integral of pdf
    UnivariateRealIntegrator integrator = new RombergIntegrator();
    for (int i = 0; i < xs.length - 1; i++) {
      double delta = integrator.integrate(new UnivariateRealFunction() {
        public double value(double v) {
          return dist.pdf(v);
        }
      }, xs[i], xs[i + 1]);
      Assert.assertEquals(delta, p[i + 1], 1.0e-6);
View Full Code Here

Examples of org.apache.commons.math.ode.AdaptiveStepsizeIntegrator.integrate()

                                    scalRelativeTolerance);

    DP54SmallLastHandler handler = new DP54SmallLastHandler(minStep);
    integ.setStepHandler(handler);
    integ.setInitialStepSize(1.7);
    integ.integrate(pb,
                    pb.getInitialTime(), pb.getInitialState(),
                    pb.getFinalTime(), new double[pb.getDimension()]);
    assertTrue(handler.wasLastSeen());
    assertEquals("Dormand-Prince 5(4)", integ.getName());
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.