Package org.jquantlib.math.solvers1D

Examples of org.jquantlib.math.solvers1D.Brent.solve()


        solver.setMaxEvaluations(maxEvaluations);
        final YieldFinder objective = new YieldFinder(notional(settlementDate()), cashflows_,
                dirtyPrice(),
                dc, comp, freq,
                settlementDate());
        return solver.solve(objective, accuracy, 0.02, 0.0, 1.0);
    }

    public/* @Rate */double yield(final DayCounter dc,
                    final Compounding comp,
                    final Frequency freq) {
View Full Code Here


        solver.setMaxEvaluations(maxEvaluations);
        final double dirtyPrice = cleanPrice + accruedAmount(settlementDate);
        final YieldFinder objective = new YieldFinder(notional(settlementDate),
                              this.cashflows_,dirtyPrice,
                              dc, comp, freq,  settlementDate);
        return solver.solve(objective, accuracy, 0.02, 0.0, 1.0);
    }

    /**
     * @see #yield(double, DayCounter, Compounding, Frequency, Date, double,
     *      int) using settlementDate = today, accuracy = 1.0e-8 and
View Full Code Here

                // is it really required?
                ts.interpolation().update();

                try {
                    final BootstrapError error = new BootstrapError(traits, ts, instrument, i);
                    final double r = solver.solve (error, ts.accuracy(), guess, min, max);
                    // redundant assignment (as it has been already performed
                    // by BootstrapError in solve procedure), but safe
                    data[i] = r;
                } catch (final Exception e) {
                    validCurve = false;
View Full Code Here

        };

        final double accuracy = 1.0e-15;
        final Brent brent = new Brent();

        double soln = brent.solve(square, accuracy, 0.01, 0, 2);

        // assertEquals(1.0, soln, accuracy);
        if (Math.abs(1.0 - soln) > accuracy) {
            fail("expected: 1.0 but was: " + (soln - accuracy));
        }
View Full Code Here

        // assertEquals(10, brent.getNumEvaluations());
        if (brent.getNumEvaluations() != 10) {
            fail("expected: 10" + " but was: " + brent.getNumEvaluations());
        }

        soln = brent.solve(square, accuracy, 0.01, 0.1);

        // assertEquals(1.0, soln,accuracy);
        if (Math.abs(1.0 - soln) > accuracy) {
            fail("expected: 1.0 but was: " + (soln - accuracy));
        }
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.