示例#1
0
文件: Complex.java 项目: mfwzan/astor
  /**
   * Compute the <a href="http://mathworld.wolfram.com/NaturalLogarithm.html" TARGET="_top"> natural
   * logarithm</a> of this complex number. Implements the formula:
   *
   * <pre>
   *  <code>
   *   log(a + bi) = ln(|a + bi|) + arg(a + bi)i
   *  </code>
   * </pre>
   *
   * where ln on the right hand side is {@link java.lang.Math#log}, {@code |a + bi|} is the modulus,
   * {@link Complex#abs}, and {@code arg(a + bi) = }{@link java.lang.Math#atan2}(b, a). <br>
   * Returns {@link Complex#NaN} if either real or imaginary part of the input argument is {@code
   * NaN}. <br>
   * Infinite (or critical) values in real or imaginary parts of the input may result in infinite or
   * NaN values returned in parts of the result.
   *
   * <pre>
   *  Examples:
   *  <code>
   *   log(1 &plusmn; INFINITY i) = INFINITY &plusmn; (&pi;/2)i
   *   log(INFINITY + i) = INFINITY + 0i
   *   log(-INFINITY + i) = INFINITY + &pi;i
   *   log(INFINITY &plusmn; INFINITY i) = INFINITY &plusmn; (&pi;/4)i
   *   log(-INFINITY &plusmn; INFINITY i) = INFINITY &plusmn; (3&pi;/4)i
   *   log(0 + 0i) = -INFINITY + 0i
   *  </code>
   * </pre>
   *
   * @return the value <code>ln &nbsp; this</code>, the natural logarithm of {@code this}.
   * @since 1.2
   */
  public Complex log() {
    if (isNaN) {
      return NaN;
    }

    return createComplex(FastMath.log(abs()), FastMath.atan2(imaginary, real));
  }
示例#2
0
 @Override
 public IComplexNumber log() {
   IComplexNumber result = dup();
   float real = (float) result.realComponent();
   float imaginary = (float) result.imaginaryComponent();
   double modulus = FastMath.sqrt(real * real + imaginary * imaginary);
   double arg = FastMath.atan2(imaginary, real);
   return result.set(FastMath.log(modulus), arg);
 }
示例#3
0
  /** {@inheritDoc} */
  @Override
  public double[] getShortPeriodicVariations(final AbsoluteDate date, final double[] meanElements)
      throws OrekitException {

    // Initialise the short periodic variations
    final double[] shortPeriodicVariation = new double[] {0., 0., 0., 0., 0., 0.};

    // Compute only if there is at least one non-resonant tesseral or
    // only the m-daily tesseral should be taken into account
    if (!nonResOrders.isEmpty() || mDailiesOnly) {

      // Build an Orbit object from the mean elements
      final Orbit meanOrbit =
          OrbitType.EQUINOCTIAL.mapArrayToOrbit(
              meanElements, PositionAngle.MEAN, date, provider.getMu(), this.frame);

      // Build an auxiliary object
      final AuxiliaryElements aux = new AuxiliaryElements(meanOrbit, I);

      // Central body rotation angle from equation 2.7.1-(3)(4).
      final Transform t = bodyFrame.getTransformTo(aux.getFrame(), aux.getDate());
      final Vector3D xB = t.transformVector(Vector3D.PLUS_I);
      final Vector3D yB = t.transformVector(Vector3D.PLUS_J);
      final double currentTheta =
          FastMath.atan2(
              -f.dotProduct(yB) + I * g.dotProduct(xB), f.dotProduct(xB) + I * g.dotProduct(yB));

      // Add the m-daily contribution
      for (int m = 1; m <= maxOrderMdailyTesseralSP; m++) {
        // Phase angle
        final double jlMmt = -m * currentTheta;
        final double sinPhi = FastMath.sin(jlMmt);
        final double cosPhi = FastMath.cos(jlMmt);

        // compute contribution for each element
        for (int i = 0; i < 6; i++) {
          shortPeriodicVariation[i] +=
              tesseralSPCoefs.getCijm(i, 0, m, date) * cosPhi
                  + tesseralSPCoefs.getSijm(i, 0, m, date) * sinPhi;
        }
      }

      // loop through all non-resonant (j,m) pairs
      for (final Map.Entry<Integer, List<Integer>> entry : nonResOrders.entrySet()) {
        final int m = entry.getKey();
        final List<Integer> listJ = entry.getValue();

        for (int j : listJ) {
          // Phase angle
          final double jlMmt = j * meanElements[5] - m * currentTheta;
          final double sinPhi = FastMath.sin(jlMmt);
          final double cosPhi = FastMath.cos(jlMmt);

          // compute contribution for each element
          for (int i = 0; i < 6; i++) {
            shortPeriodicVariation[i] +=
                tesseralSPCoefs.getCijm(i, j, m, date) * cosPhi
                    + tesseralSPCoefs.getSijm(i, j, m, date) * sinPhi;
          }
        }
      }
    }

    return shortPeriodicVariation;
  }
示例#4
0
  /** {@inheritDoc} */
  @Override
  public void initializeStep(final AuxiliaryElements aux) throws OrekitException {

    // Equinoctial elements
    a = aux.getSma();
    k = aux.getK();
    h = aux.getH();
    q = aux.getQ();
    p = aux.getP();
    lm = aux.getLM();

    // Eccentricity
    ecc = aux.getEcc();
    e2 = ecc * ecc;

    // Retrograde factor
    I = aux.getRetrogradeFactor();

    // Equinoctial frame vectors
    f = aux.getVectorF();
    g = aux.getVectorG();

    // Central body rotation angle from equation 2.7.1-(3)(4).
    final Transform t = bodyFrame.getTransformTo(aux.getFrame(), aux.getDate());
    final Vector3D xB = t.transformVector(Vector3D.PLUS_I);
    final Vector3D yB = t.transformVector(Vector3D.PLUS_J);
    theta =
        FastMath.atan2(
            -f.dotProduct(yB) + I * g.dotProduct(xB), f.dotProduct(xB) + I * g.dotProduct(yB));

    // Direction cosines
    alpha = aux.getAlpha();
    beta = aux.getBeta();
    gamma = aux.getGamma();

    // Equinoctial coefficients
    // A = sqrt(μ * a)
    final double A = aux.getA();
    // B = sqrt(1 - h² - k²)
    final double B = aux.getB();
    // C = 1 + p² + q²
    final double C = aux.getC();
    // Common factors from equinoctial coefficients
    // 2 * a / A
    ax2oA = 2. * a / A;
    // B / A
    BoA = B / A;
    // 1 / AB
    ooAB = 1. / (A * B);
    // C / 2AB
    Co2AB = C * ooAB / 2.;
    // B / (A * (1 + B))
    BoABpo = BoA / (1. + B);
    // &mu / a
    moa = provider.getMu() / a;
    // R / a
    roa = provider.getAe() / a;

    // &Chi; = 1 / B
    chi = 1. / B;
    chi2 = chi * chi;

    // mean motion n
    meanMotion = aux.getMeanMotion();
  }
示例#5
0
文件: Complex.java 项目: mfwzan/astor
 /**
  * Compute the argument of this complex number. The argument is the angle phi between the positive
  * real axis and the point representing this number in the complex plane. The value returned is
  * between -PI (not inclusive) and PI (inclusive), with negative values returned for numbers with
  * negative imaginary parts. <br>
  * If either real or imaginary part (or both) is NaN, NaN is returned. Infinite parts are handled
  * as {@code Math.atan2} handles them, essentially treating finite parts as zero in the presence
  * of an infinite coordinate and returning a multiple of pi/4 depending on the signs of the
  * infinite parts. See the javadoc for {@code Math.atan2} for full details.
  *
  * @return the argument of {@code this}.
  */
 public double getArgument() {
   return FastMath.atan2(getImaginary(), getReal());
 }