Search in sources :

Example 6 with PolynomialFunction

use of org.hipparchus.analysis.polynomials.PolynomialFunction in project Orekit by CS-SI.

the class HansenZonalLinear method generatePolynomials.

/**
 * Generate the polynomials needed in the linear transformation.
 *
 * <p>
 * See Petre's paper
 * </p>
 */
private void generatePolynomials() {
    int sliceCounter = 0;
    int index;
    // Initialisation of matrix for linear transformmations
    // The final configuration of these matrix are obtained by composition
    // of linear transformations
    PolynomialFunctionMatrix A = HansenUtilities.buildIdentityMatrix2();
    PolynomialFunctionMatrix D = HansenUtilities.buildZeroMatrix2();
    PolynomialFunctionMatrix E = HansenUtilities.buildIdentityMatrix2();
    // generation of polynomials associated to Hansen coefficients and to
    // their derivatives
    final PolynomialFunctionMatrix a = HansenUtilities.buildZeroMatrix2();
    a.setElem(0, 1, HansenUtilities.ONE);
    // The B matrix is constant.
    final PolynomialFunctionMatrix B = HansenUtilities.buildZeroMatrix2();
    // from Collins 4-245 and Petre's paper
    B.setElem(1, 1, new PolynomialFunction(new double[] { 2.0 }));
    for (int i = N0 - 1; i > Nmin - 1; i--) {
        index = i + offset;
        // Matrix of the current linear transformation
        // Petre's paper
        a.setMatrixLine(1, new PolynomialFunction[] { b(i), a(i) });
        // composition of linear transformations
        // see Petre's paper
        A = A.multiply(a);
        // store the polynomials for Hansen coefficients
        mpvec[index] = A.getMatrixLine(1);
        D = D.multiply(a);
        E = E.multiply(a);
        D = D.add(E.multiply(B));
        // store the polynomials for Hansen coefficients from the expressions
        // of derivatives
        mpvecDeriv[index] = D.getMatrixLine(1);
        if (++sliceCounter % SLICE == 0) {
            // Re-Initialisation of matrix for linear transformmations
            // The final configuration of these matrix are obtained by composition
            // of linear transformations
            A = HansenUtilities.buildIdentityMatrix2();
            D = HansenUtilities.buildZeroMatrix2();
            E = HansenUtilities.buildIdentityMatrix2();
        }
    }
}
Also used : PolynomialFunction(org.hipparchus.analysis.polynomials.PolynomialFunction)

Example 7 with PolynomialFunction

use of org.hipparchus.analysis.polynomials.PolynomialFunction in project Orekit by CS-SI.

the class JacobiPolynomials method getValue.

/**
 * Returns the value and derivatives of the Jacobi polynomial P<sub>l</sub><sup>v,w</sup> evaluated at γ.
 * <p>
 * This method is guaranteed to be thread-safe
 * </p>
 * @param l degree of the polynomial
 * @param v v value
 * @param w w value
 * @param gamma γ value
 * @return value and derivatives of the Jacobi polynomial P<sub>l</sub><sup>v,w</sup>(γ)
 */
public static DerivativeStructure getValue(final int l, final int v, final int w, final DerivativeStructure gamma) {
    final List<PolynomialFunction> polyList;
    synchronized (MAP) {
        final JacobiKey key = new JacobiKey(v, w);
        // Check the existence of the corresponding key in the map.
        if (!MAP.containsKey(key)) {
            MAP.put(key, new ArrayList<PolynomialFunction>());
        }
        polyList = MAP.get(key);
    }
    final PolynomialFunction polynomial;
    synchronized (polyList) {
        // up to this degree are computed.
        for (int degree = polyList.size(); degree <= l; degree++) {
            polyList.add(degree, PolynomialsUtils.createJacobiPolynomial(degree, v, w));
        }
        polynomial = polyList.get(l);
    }
    // compute value and derivative
    return polynomial.value(gamma);
}
Also used : PolynomialFunction(org.hipparchus.analysis.polynomials.PolynomialFunction)

Example 8 with PolynomialFunction

use of org.hipparchus.analysis.polynomials.PolynomialFunction in project Orekit by CS-SI.

the class HansenTesseralLinear method computeInitValues.

/**
 * Compute the values for the first four coefficients and their derivatives by means of series.
 *
 * @param e2 e²
 * @param chi &Chi;
 * @param chi2 &Chi;²
 */
public void computeInitValues(final double e2, final double chi, final double chi2) {
    // compute the values for n, n+1, n+2 and n+3 by series
    // See Danielson 2.7.3-(10)
    // Ensure that only the needed terms are computed
    final int maxRoots = FastMath.min(4, N0 - Nmin + 4);
    for (int i = 0; i < maxRoots; i++) {
        final DerivativeStructure hansenKernel = hansenInit[i].getValue(e2, chi, chi2);
        this.hansenRoot[0][i] = hansenKernel.getValue();
        this.hansenDerivRoot[0][i] = hansenKernel.getPartialDerivative(1);
    }
    for (int i = 1; i < numSlices; i++) {
        for (int k = 0; k < 4; k++) {
            final PolynomialFunction[] mv = mpvec[N0 - (i * SLICE) - k + 3 + offset];
            final PolynomialFunction[] sv = mpvecDeriv[N0 - (i * SLICE) - k + 3 + offset];
            hansenDerivRoot[i][k] = mv[3].value(chi) * hansenDerivRoot[i - 1][3] + mv[2].value(chi) * hansenDerivRoot[i - 1][2] + mv[1].value(chi) * hansenDerivRoot[i - 1][1] + mv[0].value(chi) * hansenDerivRoot[i - 1][0] + sv[3].value(chi) * hansenRoot[i - 1][3] + sv[2].value(chi) * hansenRoot[i - 1][2] + sv[1].value(chi) * hansenRoot[i - 1][1] + sv[0].value(chi) * hansenRoot[i - 1][0];
            hansenRoot[i][k] = mv[3].value(chi) * hansenRoot[i - 1][3] + mv[2].value(chi) * hansenRoot[i - 1][2] + mv[1].value(chi) * hansenRoot[i - 1][1] + mv[0].value(chi) * hansenRoot[i - 1][0];
        }
    }
}
Also used : DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) PolynomialFunction(org.hipparchus.analysis.polynomials.PolynomialFunction)

Example 9 with PolynomialFunction

use of org.hipparchus.analysis.polynomials.PolynomialFunction in project Orekit by CS-SI.

the class NewcombOperators method getValue.

/**
 * Get the Newcomb operator evaluated at n, s, ρ, σ.
 * <p>
 * This method is guaranteed to be thread-safe
 * </p>
 *  @param rho ρ index
 *  @param sigma σ index
 *  @param n n index
 *  @param s s index
 *  @return Y<sub>ρ,σ</sub><sup>n,s</sup>
 */
public static double getValue(final int rho, final int sigma, final int n, final int s) {
    final NewKey key = new NewKey(n, s, rho, sigma);
    synchronized (MAP) {
        if (MAP.containsKey(key)) {
            return MAP.get(key);
        }
    }
    // Get the Newcomb polynomials for the given rho and sigma
    final List<PolynomialFunction> polynomials = PolynomialsGenerator.getPolynomials(rho, sigma);
    // Compute the value from the list of polynomials for the given n and s
    double nPower = 1.;
    double value = 0.0;
    for (final PolynomialFunction polynomial : polynomials) {
        value += polynomial.value(s) * nPower;
        nPower = n * nPower;
    }
    synchronized (MAP) {
        MAP.put(key, value);
    }
    return value;
}
Also used : PolynomialFunction(org.hipparchus.analysis.polynomials.PolynomialFunction)

Example 10 with PolynomialFunction

use of org.hipparchus.analysis.polynomials.PolynomialFunction in project Orekit by CS-SI.

the class PolynomialFunctionMatrix method multiply.

/**
 * Multiply the argument matrix with the current matrix.
 *
 * @param matrix
 *            the argument matrix
 * @return the result of the multiplication
 */
public PolynomialFunctionMatrix multiply(final PolynomialFunctionMatrix matrix) {
    final PolynomialFunctionMatrix result = new PolynomialFunctionMatrix(order);
    for (int i = 0; i < order; i++) {
        for (int j = 0; j < order; j++) {
            PolynomialFunction cc = HansenUtilities.ZERO;
            for (int k = 0; k < order; k++) {
                cc = cc.add(matrix.getElem(i, k).multiply(elements[k][j]));
            }
            result.setElem(i, j, cc);
        }
    }
    return result;
}
Also used : PolynomialFunction(org.hipparchus.analysis.polynomials.PolynomialFunction)

Aggregations

PolynomialFunction (org.hipparchus.analysis.polynomials.PolynomialFunction)16 Test (org.junit.Test)9 AbsoluteDate (org.orekit.time.AbsoluteDate)8 ArrayList (java.util.ArrayList)6 Random (java.util.Random)6 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)4 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)4 FieldDerivativeStructure (org.hipparchus.analysis.differentiation.FieldDerivativeStructure)3 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)3 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)3 PVCoordinates (org.orekit.utils.PVCoordinates)2 BodyCenterPointing (org.orekit.attitudes.BodyCenterPointing)1 BodyShape (org.orekit.bodies.BodyShape)1 GeodeticPoint (org.orekit.bodies.GeodeticPoint)1 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)1 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)1 Propagator (org.orekit.propagation.Propagator)1 FieldEcksteinHechlerPropagator (org.orekit.propagation.analytical.FieldEcksteinHechlerPropagator)1 NSKey (org.orekit.propagation.semianalytical.dsst.utilities.CoefficientsFactory.NSKey)1 DateComponents (org.orekit.time.DateComponents)1