Search in sources :

Example 16 with UnivariateDifferentiableFunction

use of org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction in project Orekit by CS-SI.

the class FieldCartesianOrbitTest method differentiate.

private <T extends RealFieldElement<T>, S extends Function<FieldCartesianOrbit<T>, T>> double differentiate(TimeStampedFieldPVCoordinates<T> pv, Frame frame, double mu, S picker) {
    final DSFactory factory = new DSFactory(1, 1);
    FiniteDifferencesDifferentiator differentiator = new FiniteDifferencesDifferentiator(8, 0.1);
    UnivariateDifferentiableFunction diff = differentiator.differentiate(new UnivariateFunction() {

        public double value(double dt) {
            return picker.apply(new FieldCartesianOrbit<>(pv.shiftedBy(dt), frame, mu)).getReal();
        }
    });
    return diff.value(factory.variable(0, 0.0)).getPartialDerivative(1);
}
Also used : UnivariateFunction(org.hipparchus.analysis.UnivariateFunction) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) UnivariateDifferentiableFunction(org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction) FiniteDifferencesDifferentiator(org.hipparchus.analysis.differentiation.FiniteDifferencesDifferentiator)

Example 17 with UnivariateDifferentiableFunction

use of org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction in project Orekit by CS-SI.

the class FieldKeplerianOrbitTest method differentiate.

private <T extends RealFieldElement<T>, S extends Function<FieldKeplerianOrbit<T>, T>> double differentiate(FieldKeplerianOrbit<T> orbit, S picker) {
    final DSFactory factory = new DSFactory(1, 1);
    FiniteDifferencesDifferentiator differentiator = new FiniteDifferencesDifferentiator(8, 0.1);
    UnivariateDifferentiableFunction diff = differentiator.differentiate(new UnivariateFunction() {

        public double value(double dt) {
            return picker.apply(orbit.shiftedBy(orbit.getDate().getField().getZero().add(dt))).getReal();
        }
    });
    return diff.value(factory.variable(0, 0.0)).getPartialDerivative(1);
}
Also used : UnivariateFunction(org.hipparchus.analysis.UnivariateFunction) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) UnivariateDifferentiableFunction(org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction) FiniteDifferencesDifferentiator(org.hipparchus.analysis.differentiation.FiniteDifferencesDifferentiator)

Example 18 with UnivariateDifferentiableFunction

use of org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction in project Orekit by CS-SI.

the class KeplerianOrbitTest method differentiate.

private <S extends Function<KeplerianOrbit, Double>> double differentiate(TimeStampedPVCoordinates pv, Frame frame, double mu, S picker) {
    final DSFactory factory = new DSFactory(1, 1);
    FiniteDifferencesDifferentiator differentiator = new FiniteDifferencesDifferentiator(8, 0.1);
    UnivariateDifferentiableFunction diff = differentiator.differentiate(new UnivariateFunction() {

        public double value(double dt) {
            return picker.apply(new KeplerianOrbit(pv.shiftedBy(dt), frame, mu));
        }
    });
    return diff.value(factory.variable(0, 0.0)).getPartialDerivative(1);
}
Also used : UnivariateFunction(org.hipparchus.analysis.UnivariateFunction) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) UnivariateDifferentiableFunction(org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction) FiniteDifferencesDifferentiator(org.hipparchus.analysis.differentiation.FiniteDifferencesDifferentiator)

Aggregations

UnivariateDifferentiableFunction (org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction)18 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)17 FiniteDifferencesDifferentiator (org.hipparchus.analysis.differentiation.FiniteDifferencesDifferentiator)16 UnivariateFunction (org.hipparchus.analysis.UnivariateFunction)15 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)7 Test (org.junit.Test)5 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)4 TimeScale (org.orekit.time.TimeScale)3 AbsoluteDate (org.orekit.time.AbsoluteDate)2 IERSConventions (org.orekit.utils.IERSConventions)2 UnivariateVectorFunction (org.hipparchus.analysis.UnivariateVectorFunction)1 UnivariateDifferentiableVectorFunction (org.hipparchus.analysis.differentiation.UnivariateDifferentiableVectorFunction)1 Decimal64 (org.hipparchus.util.Decimal64)1 OldIAUPole (org.orekit.bodies.IAUPoleFactory.OldIAUPole)1 OrekitException (org.orekit.errors.OrekitException)1 OrekitExceptionWrapper (org.orekit.errors.OrekitExceptionWrapper)1 PVCoordinates (org.orekit.utils.PVCoordinates)1 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)1