Package org.apache.commons.math3.analysis.polynomials

Examples of org.apache.commons.math3.analysis.polynomials.PolynomialFunction.derivative()


        DifferentiableUnivariateFunction pow = new Power(2);
        Assert.assertEquals(108, FunctionUtils.compose(pow, pow).derivative().value(3), EPS);

        DifferentiableUnivariateFunction log = new Log();
        double a = 9876.54321;
        Assert.assertEquals(pow.derivative().value(a) / pow.value(a),
                            FunctionUtils.compose(log, pow).derivative().value(a), EPS);
    }

    @Test
    public void testAdd() {
View Full Code Here


        // Sin implements both UnivariateDifferentiableFunction and DifferentiableUnivariateFunction
        Sin sin = new Sin();
        DifferentiableUnivariateFunction converted = FunctionUtils.toDifferentiableUnivariateFunction(sin);
        for (double x = 0.1; x < 0.5; x += 0.01) {
            Assert.assertEquals(sin.value(x), converted.value(x), 1.0e-10);
            Assert.assertEquals(sin.derivative().value(x), converted.derivative().value(x), 1.0e-10);
        }

    }

    @Test
View Full Code Here

        // Sin implements both UnivariateDifferentiableFunction and DifferentiableUnivariateFunction
        Sin sin = new Sin();
        DifferentiableUnivariateFunction converted = FunctionUtils.toDifferentiableUnivariateFunction(sin);
        for (double x = 0.1; x < 0.5; x += 0.01) {
            Assert.assertEquals(sin.value(x), converted.value(x), 1.0e-10);
            Assert.assertEquals(sin.derivative().value(x), converted.derivative().value(x), 1.0e-10);
        }

    }

    @Test
View Full Code Here

            SparseGradient sgX = SparseGradient.createVariable(0, x);
            SparseGradient sgY1 = sgX.getField().getZero();
            for (int i = poly.degree(); i >= 0; --i) {
                sgY1 = sgY1.multiply(sgX).add(poly.getCoefficients()[i]);
            }
            SparseGradient sgY2 = sgX.compose(poly.value(x), poly.derivative().value(x));
            SparseGradient zero = sgY1.subtract(sgY2);
            checkF0F1(zero, 0.0, 0.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.