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);
}
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);
}
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);
}
Aggregations