Package org.jquantlib.math.solvers1D

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


                // 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


        solver.setMaxEvaluations(maxEvaluations);
        final YieldFinder objective = new YieldFinder(notional(settlementDate()), this.cashflows_,
                getDirtyPrice(),
                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

                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

         * QL_WARN( "danger of non-unique solution"); }
         */

        final Brent solver = new Brent();
        solver.setMaxEvaluations(maxIterations);
        return solver.solve(new IRRFinder(cashflows, marketPrice, dayCounter, compounding, frequency, date), tolerance, guess,
                guess / 10.0);
    }

    public double irr(final Leg leg, final double marketPrice, final DayCounter dayCounter, final Compounding compounding) {
        return irr(
View Full Code Here

            for (int i=0; i<(timeGrid.size() - 1); i++) {
                final double discountBond = theta.termStructure().currentLink().discount(t.get(i+1));
                final Helper finder = new Helper(i, discountBond, theta, this);
                final Brent s1d = new Brent();
                s1d.setMaxEvaluations(1000);
                value = s1d.solve(finder, 1e-7, value, vMin, vMax);
                // vMin = value - 1.0;
                // vMax = value + 1.0;
                theta.change(value);
            }
        }
View Full Code Here

    public double /* @Volatility */impliedVolatility(final double /* @Real */targetValue, final double /* @Real */accuracy,
            final int /* @Size */maxEvaluations, final double /* @Volatility */minVol, final double /* @Volatility */maxVol){
        final ImpliedVolatilityHelper f = new ImpliedVolatilityHelper(this, targetValue);
        final Brent solver = new Brent();
        solver.setMaxEvaluations(maxEvaluations);
        return solver.solve(f, accuracy, volatility_.currentLink().value(), minVol, maxVol);
    }

    public void setPricingEngine(final PricingEngine engine) {
        this.engine_ = engine;
    }
View Full Code Here

            final double /* @Real */dx = trinomial.dx(i);

            final Helper finder = new BlackKarasinski.Helper(i, xMin, dx, discountBond, numericTree);
            final Brent s1d = new Brent();
            s1d.setMaxEvaluations(1000);
            value = s1d.solve(finder, 1e-7, value, vMin, vMax);
            impl.set(grid.index(i) /* [i] */, value);
            // vMin = value - 10.0;
            // vMax = value + 10.0;
        }
        return numericTree;
View Full Code Here

         * QL_WARN( "danger of non-unique solution"); }
         */

        final Brent solver = new Brent();
        solver.setMaxEvaluations(maxIterations);
        return solver.solve(new IRRFinder(cashflows, marketPrice, dayCounter, compounding, frequency, date), tolerance, guess,
                guess / 10.0);
    }

    public double irr(final Leg leg, final double marketPrice, final DayCounter dayCounter, final Compounding compounding) {
        return irr(
View Full Code Here

            final SolvingFunction function = new SolvingFunction(lambda, Bb_);
            final Brent s1d = new Brent();
            s1d.setMaxEvaluations(1000);

            final double /* @Real */yb = s1d.solve(function, 1e-6, 0.00, -100.0, 100.0);
            final double /* @Real */h1 = (yb - muy_) / (sigmay_ * txy) - rhoxy_ * (x - mux_) / (sigmax_ * txy);
            // not sure if evaluate method is equivalent of op overloading -> we have to test it ;-)
            double /* @Real */value = /* phi(-w_*h1) */phi.op(-w_ * h1);

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

        final PriceError f = new PriceError(engine, volQuote, targetValue);

        final Brent solver = new Brent();
        solver.setMaxEvaluations(maxEvaluations);
        final /*@Volatility*/ double guess = (minVol+maxVol)/2.0;
        final /*@Volatility*/ double result = solver.solve(f, accuracy, guess, minVol, maxVol);
        return result;
    }

    /**
     * The returned process is equal to the passed one, except for the volatility which
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.