Package net.sf.doodleproject.numerics4j.util

Examples of net.sf.doodleproject.numerics4j.util.DoubleArray


     */
    public double integrate(double a, double b) throws NumericException {
        TrapezoidalIntegrator.IterativeState state = new TrapezoidalIntegrator.IterativeState(
            function, a, b);

        DoubleArray r0 = new DoubleArray();
        DoubleArray r1 = new DoubleArray();
        double error = Double.MAX_VALUE;
        int n;

        r0.add(state.getResult());
        do {
            state.iterate();
            n = state.getIterations();

            r1.clear();
            r1.add(state.getResult());
            double d = 4.0;
            for (int i = 0; i < n; ++i) {
                r1.add(r1.get(i) + (r1.get(i) - r0.get(i)) / (d - 1.0));
                d *= 4.0;
            }
            error = Math.abs(r1.get(n) / r0.get(n - 1) - 1.0);
            r0 = r1;
            r1 = new DoubleArray();
        } while (n < getMaximumIterations()
            && error > getMaximumRelativeError());

        if (n >= getMaximumIterations()) {
            throw new ConvergenceException(
View Full Code Here

TOP

Related Classes of net.sf.doodleproject.numerics4j.util.DoubleArray

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.