Examples of HyperbolicMeshing


Examples of com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing

    final double t = 5.0;
    final int tNodes = 50;
    final int xNodes = 100;

    final MeshingFunction timeMesh = new ExponentialMeshing(0, t, tNodes, 2.0);
    final MeshingFunction spaceMesh = new HyperbolicMeshing(0, 6.0 * FORWARD_CURVE.getForward(t), FORWARD_CURVE.getSpot(), xNodes, 0.01);
    final PDEGrid1D grid = new PDEGrid1D(timeMesh, spaceMesh);
    //TwoStateMarkovChainDensity densityCal = new TwoStateMarkovChainDensity(forward, chainData);
    final TwoStateMarkovChainWithLocalVolDensity densityCal = new TwoStateMarkovChainWithLocalVolDensity(FORWARD_CURVE, DATA, new AbsoluteLocalVolatilitySurface(ConstantDoublesSurface.from(1.0)));
    final PDEFullResults1D[] denRes = densityCal.solve(grid);
    System.out.println("Densities ");
View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing

    int tNodes = 100;
    int xNodes = 200;

    MeshingFunction timeMesh = new ExponentialMeshing(0, T, tNodes, 5.0);
    //MeshingFunction spaceMesh = new ExponentialMeshing(0.0, 6.0 * FORWARD.getForward(T), xNodes, 3.0);
    MeshingFunction spaceMesh = new HyperbolicMeshing(-0.0 * FORWARD.getForward(T), 6.0 * FORWARD.getForward(T), FORWARD.getSpot(), xNodes, 0.01);

    PDEGrid1D grid = new PDEGrid1D(timeMesh, spaceMesh);

    PDEFullResults1D[] res = DENSITY_CAL.solve(grid);

View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing

  @Test
  public void degenerateTest() {
    int tNodes = 20;
    int xNodes = 100;
    MeshingFunction timeMesh = new ExponentialMeshing(0, T, tNodes, 5.0);
    MeshingFunction spaceMesh = new HyperbolicMeshing(-0.0 * FORWARD.getForward(T), 6.0 * FORWARD.getForward(T), FORWARD.getSpot(), xNodes, 0.01);
    PDEGrid1D grid = new PDEGrid1D(timeMesh, spaceMesh);

    double l12 = 0.3;
    double l21 = 2.0;
    double pi1 = l21 / (l12 + l21);
View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing

    //    BoundaryCondition upper = new FixedSecondDerivativeBoundaryCondition(0.0, xH, false);

    // MeshingFunction timeMesh = new ExponentialMeshing(0.0, expiry, nTimeNodes, timeMeshLambda);
    final MeshingFunction timeMesh = new ExponentialMeshing(0, EXPIRY, 50, 0.0);
    //  final MeshingFunction spaceMesh = new ExponentialMeshing(fL, fH, 101, 0.0);
    final MeshingFunction spaceMesh = new HyperbolicMeshing(fL, fH, (fL + fH) / 2, 101, 0.4);

    // ZZConvectionDiffusionPDEDataBundle pde_data = PDE_DATA_PROVIDER.getBackwardsLocalVolLogPayoff(EXPIRY, lvm);
    final ConvectionDiffusionPDE1DStandardCoefficients pde = PDE_DATA_PROVIDER.getLogBackwardsLocalVol(EXPIRY, lvm);

    final PDEGrid1D grid = new PDEGrid1D(timeMesh, spaceMesh);
View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing

  public void test() {
    final double theta = 0.55;
    final int tNodes = 51;
    final int xNodes = 151;
    final MeshingFunction timeMesh = new ExponentialMeshing(0, T, tNodes, 7.5);
    final MeshingFunction spaceMesh = new HyperbolicMeshing(0, 10 * SPOT, SPOT, xNodes, 0.01);
    final PDEGrid1D grid = new PDEGrid1D(timeMesh, spaceMesh);
    final PDEFullResults1D res = PRICER.solve(grid, theta);

    final double[] expiries = timeMesh.getPoints();
    final double[] strikes = spaceMesh.getPoints();
    final double[] forwards = new double[tNodes];
    // double[] df = new double[tNodes];
    for (int i = 0; i < tNodes; i++) {

      forwards[i] = FORWARD_CURVE.getForward(expiries[i]);
View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing

    final ExtendedCoupledFiniteDifference solver = new ExtendedCoupledFiniteDifference(0.5);
    final int tNodes = 50;
    final int xNodes = 150;

    final MeshingFunction timeMesh = new ExponentialMeshing(0, T, tNodes, 5.0);
    final MeshingFunction spaceMesh = new HyperbolicMeshing(LOWER.getLevel(), UPPER.getLevel(), SPOT, xNodes, 0.01);

    final double[] timeGrid = new double[tNodes];
    for (int n = 0; n < tNodes; n++) {
      timeGrid[n] = timeMesh.evaluate(n);
    }

    final double[] spaceGrid = new double[xNodes];
    for (int i = 0; i < xNodes; i++) {
      spaceGrid[i] = spaceMesh.evaluate(i);
    }
    final PDEGrid1D grid = new PDEGrid1D(timeGrid, spaceGrid);

    final PDEResults1D[] res = solver.solve(DATA1, DATA2, grid, LOWER, UPPER, LOWER, UPPER, null);
    final PDEFullResults1D res1 = (PDEFullResults1D) res[0];
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.