Interface CalculusFieldElement<T extends FieldElement<T>>

Type Parameters:
T - the type of the field elements
All Superinterfaces:
FieldElement<T>
All Known Subinterfaces:
Derivative<T>, Derivative1<T>, FieldDerivative<S,T>, FieldDerivative1<S,T>
All Known Implementing Classes:
Binary64, Complex, DerivativeStructure, Dfp, DfpDec, FieldComplex, FieldDerivativeStructure, FieldGradient, FieldTuple, FieldUnivariateDerivative, FieldUnivariateDerivative1, FieldUnivariateDerivative2, Gradient, SparseGradient, Tuple, UnivariateDerivative, UnivariateDerivative1, UnivariateDerivative2

public interface CalculusFieldElement<T extends FieldElement<T>> extends FieldElement<T>
Interface representing a field with calculus capabilities (sin, cos, ...).
Since:
1.7
See Also:
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    abs()
    absolute value.
    Arc cosine operation.
    Inverse hyperbolic cosine operation.
    default T
    add(double a)
    '+' operator.
    Arc sine operation.
    Inverse hyperbolic sine operation.
    Arc tangent operation.
    atan2(T x)
    Two arguments arc tangent operation.
    Inverse hyperbolic tangent operation.
    default T
    Cubic root.
    default T
    Get the smallest whole number larger than instance.
    default T
    copySign(double sign)
    Returns the instance with the sign of the argument.
    copySign(T sign)
    Returns the instance with the sign of the argument.
    cos()
    Cosine operation.
    Hyperbolic cosine operation.
    default T
    divide(double a)
    '÷' operator.
    default T
    divide(T a)
    Compute this ÷ a.
    exp()
    Exponential.
    Exponential minus 1.
    default T
    Get the largest whole number smaller than instance.
    Get the addendum to the real value of the number.
    default int
    Return the exponent of the instance, removing the bias.
    default T
    Get the Archimedes constant π.
    hypot(T y)
    Returns the hypotenuse of a triangle with sides this and y - sqrt(this2 +y2) avoiding intermediate overflow or underflow.
    default boolean
    Check if the instance is finite (neither infinite nor NaN).
    default boolean
    Check if the instance is infinite.
    default boolean
    Check if the instance is Not a Number.
    default T
    linearCombination(double[] a, T[] b)
    Compute a linear combination.
    default T
    linearCombination(double a1, T b1, double a2, T b2)
    Compute a linear combination.
    default T
    linearCombination(double a1, T b1, double a2, T b2, double a3, T b3)
    Compute a linear combination.
    default T
    linearCombination(double a1, T b1, double a2, T b2, double a3, T b3, double a4, T b4)
    Compute a linear combination.
    linearCombination(T[] a, T[] b)
    Compute a linear combination.
    linearCombination(T a1, T b1, T a2, T b2)
    Compute a linear combination.
    linearCombination(T a1, T b1, T a2, T b2, T a3, T b3)
    Compute a linear combination.
    linearCombination(T a1, T b1, T a2, T b2, T a3, T b3, T a4, T b4)
    Compute a linear combination.
    log()
    Natural logarithm.
    Base 10 logarithm.
    Shifted natural logarithm.
    default T
    multiply(double a)
    '×' operator.
    default T
    multiply(int n)
    Compute n × this.
    newInstance(double value)
    Create an instance corresponding to a constant real value.
    default double
    norm.
    default T
    pow(double p)
    Power operation.
    default T
    pow(int n)
    Integer power operation.
    pow(T e)
    Power operation.
    remainder(double a)
    IEEE remainder operator.
    IEEE remainder operator.
    default T
    Get the whole number that is the nearest to the instance, or the even one if x is exactly half way between two integers.
    default T
    rootN(int n)
    Nth root.
    default long
    Get the closest long to instance real value.
    scalb(int n)
    Multiply the instance by a power of 2.
    default T
    Compute the sign of the instance.
    sin()
    Sine operation.
    default FieldSinCos<T>
    Combined Sine and Cosine operation.
    Hyperbolic sine operation.
    default FieldSinhCosh<T>
    Combined hyperbolic sine and cosine operation.
    default T
    Square root.
    default T
    Compute this × this.
    default T
    subtract(double a)
    '-' operator.
    default T
    Compute this - a.
    default T
    tan()
    Tangent operation.
    default T
    Hyperbolic tangent operation.
    default T
    Convert radians to degrees, with error of less than 0.5 ULP
    default T
    Convert degrees to radians, with error of less than 0.5 ULP
    default T
    ulp()
    Compute least significant bit (Unit in Last Position) for a number.

    Methods inherited from interface org.hipparchus.FieldElement Link icon

    add, getField, getReal, isZero, multiply, negate, reciprocal
  • Method Details Link icon

    • getAddendum Link icon

      T getAddendum()
      Get the addendum to the real value of the number.

      The addendum is considered to be the part that when added back to the real part recovers the instance. This means that when e.getReal() is finite (i.e. neither infinite nor NaN), then e.getAddendum().add(e.getReal()) is e and e.subtract(e.getReal()) is e.getAddendum(). Beware that for non-finite numbers, these two equalities may not hold. The first equality (with the addition), always holds even for infinity and NaNs if the real part is independent of the addendum (this is the case for all derivatives types, as well as for complex and Dfp, but it is not the case for Tuple and FieldTuple). The second equality (with the subtraction), generally doesn't hold for non-finite numbers, because the subtraction generates NaNs.

      Returns:
      real value
      Since:
      4.0
    • getPi Link icon

      default T getPi()
      Get the Archimedes constant π.

      Archimedes constant is the ratio of a circle's circumference to its diameter.

      Returns:
      Archimedes constant π
      Since:
      2.0
    • newInstance Link icon

      T newInstance(double value)
      Create an instance corresponding to a constant real value.
      Parameters:
      value - constant real value
      Returns:
      instance corresponding to a constant real value
    • add Link icon

      default T add(double a)
      '+' operator.
      Parameters:
      a - right hand side parameter of the operator
      Returns:
      this+a
    • subtract Link icon

      default T subtract(double a)
      '-' operator.
      Parameters:
      a - right hand side parameter of the operator
      Returns:
      this-a
    • subtract Link icon

      default T subtract(T a)
      Compute this - a.
      Specified by:
      subtract in interface FieldElement<T extends FieldElement<T>>
      Parameters:
      a - element to subtract
      Returns:
      a new element representing this - a
    • multiply Link icon

      default T multiply(double a)
      '×' operator.
      Parameters:
      a - right hand side parameter of the operator
      Returns:
      this×a
    • multiply Link icon

      default T multiply(int n)
      Compute n × this. Multiplication by an integer number is defined as the following sum n×this=i=1nthis
      Specified by:
      multiply in interface FieldElement<T extends FieldElement<T>>
      Parameters:
      n - Number of times this must be added to itself.
      Returns:
      A new element representing n × this.
    • divide Link icon

      default T divide(double a)
      '÷' operator.
      Parameters:
      a - right hand side parameter of the operator
      Returns:
      this÷a
    • getExponent Link icon

      default int getExponent()
      Return the exponent of the instance, removing the bias.

      For double numbers of the form 2x, the unbiased exponent is exactly x.

      Returns:
      exponent for the instance, without bias
    • scalb Link icon

      T scalb(int n)
      Multiply the instance by a power of 2.
      Parameters:
      n - power of 2
      Returns:
      this × 2n
    • ulp Link icon

      default T ulp()
      Compute least significant bit (Unit in Last Position) for a number.
      Returns:
      ulp(this)
      Since:
      2.0
    • hypot Link icon

      T hypot(T y) throws MathIllegalArgumentException
      Returns the hypotenuse of a triangle with sides this and y - sqrt(this2 +y2) avoiding intermediate overflow or underflow.
      • If either argument is infinite, then the result is positive infinity.
      • else, if either argument is NaN then the result is NaN.
      Parameters:
      y - a value
      Returns:
      sqrt(this2 +y2)
      Throws:
      MathIllegalArgumentException - if number of free parameters or orders are inconsistent
    • divide Link icon

      default T divide(T a)
      Compute this ÷ a.
      Specified by:
      divide in interface FieldElement<T extends FieldElement<T>>
      Parameters:
      a - element to divide by
      Returns:
      a new element representing this ÷ a
    • sqrt Link icon

      default T sqrt()
      Square root.
      Returns:
      square root of the instance
    • cbrt Link icon

      default T cbrt()
      Cubic root.
      Returns:
      cubic root of the instance
    • rootN Link icon

      default T rootN(int n)
      Nth root.
      Parameters:
      n - order of the root
      Returns:
      nth root of the instance
    • square Link icon

      default T square()
      Compute this × this.
      Returns:
      a new element representing this × this
      Since:
      3.1
    • pow Link icon

      default T pow(double p)
      Power operation.
      Parameters:
      p - power to apply
      Returns:
      thisp
    • pow Link icon

      default T pow(int n)
      Integer power operation.
      Parameters:
      n - power to apply
      Returns:
      thisn
    • pow Link icon

      Power operation.
      Parameters:
      e - exponent
      Returns:
      thise
      Throws:
      MathIllegalArgumentException - if number of free parameters or orders are inconsistent
    • exp Link icon

      T exp()
      Exponential.
      Returns:
      exponential of the instance
    • expm1 Link icon

      T expm1()
      Exponential minus 1.
      Returns:
      exponential minus one of the instance
    • log Link icon

      T log()
      Natural logarithm.
      Returns:
      logarithm of the instance
    • log1p Link icon

      T log1p()
      Shifted natural logarithm.
      Returns:
      logarithm of one plus the instance
    • log10 Link icon

      T log10()
      Base 10 logarithm.
      Returns:
      base 10 logarithm of the instance
    • cos Link icon

      T cos()
      Cosine operation.
      Returns:
      cos(this)
    • sin Link icon

      T sin()
      Sine operation.
      Returns:
      sin(this)
    • sinCos Link icon

      default FieldSinCos<T> sinCos()
      Combined Sine and Cosine operation.
      Returns:
      [sin(this), cos(this)]
      Since:
      1.4
    • tan Link icon

      default T tan()
      Tangent operation.
      Returns:
      tan(this)
    • acos Link icon

      T acos()
      Arc cosine operation.
      Returns:
      acos(this)
    • asin Link icon

      T asin()
      Arc sine operation.
      Returns:
      asin(this)
    • atan Link icon

      T atan()
      Arc tangent operation.
      Returns:
      atan(this)
    • atan2 Link icon

      T atan2(T x) throws MathIllegalArgumentException
      Two arguments arc tangent operation.

      Beware of the order or arguments! As this is based on a two-arguments functions, in order to be consistent with arguments order, the instance is the first argument and the single provided argument is the second argument. In order to be consistent with programming languages atan2, this method computes atan2(this, x), i.e. the instance represents the y argument and the x argument is the one passed as a single argument. This may seem confusing especially for users of Wolfram alpha, as this site is not consistent with programming languages atan2 two-arguments arc tangent and puts x as its first argument.

      Parameters:
      x - second argument of the arc tangent
      Returns:
      atan2(this, x)
      Throws:
      MathIllegalArgumentException - if number of free parameters or orders are inconsistent
    • cosh Link icon

      T cosh()
      Hyperbolic cosine operation.
      Returns:
      cosh(this)
    • sinh Link icon

      T sinh()
      Hyperbolic sine operation.
      Returns:
      sinh(this)
    • sinhCosh Link icon

      default FieldSinhCosh<T> sinhCosh()
      Combined hyperbolic sine and cosine operation.
      Returns:
      [sinh(this), cosh(this)]
      Since:
      2.0
    • tanh Link icon

      default T tanh()
      Hyperbolic tangent operation.
      Returns:
      tanh(this)
    • acosh Link icon

      T acosh()
      Inverse hyperbolic cosine operation.
      Returns:
      acosh(this)
    • asinh Link icon

      T asinh()
      Inverse hyperbolic sine operation.
      Returns:
      asin(this)
    • atanh Link icon

      T atanh()
      Inverse hyperbolic tangent operation.
      Returns:
      atanh(this)
    • toDegrees Link icon

      default T toDegrees()
      Convert radians to degrees, with error of less than 0.5 ULP
      Returns:
      instance converted into degrees
    • toRadians Link icon

      default T toRadians()
      Convert degrees to radians, with error of less than 0.5 ULP
      Returns:
      instance converted into radians
    • linearCombination Link icon

      T linearCombination(T[] a, T[] b) throws MathIllegalArgumentException
      Compute a linear combination.
      Parameters:
      a - Factors.
      b - Factors.
      Returns:
      Σi ai bi.
      Throws:
      MathIllegalArgumentException - if arrays dimensions don't match
    • linearCombination Link icon

      default T linearCombination(double[] a, T[] b) throws MathIllegalArgumentException
      Compute a linear combination.
      Parameters:
      a - Factors.
      b - Factors.
      Returns:
      Σi ai bi.
      Throws:
      MathIllegalArgumentException - if arrays dimensions don't match
    • linearCombination Link icon

      T linearCombination(T a1, T b1, T a2, T b2)
      Compute a linear combination.
      Parameters:
      a1 - first factor of the first term
      b1 - second factor of the first term
      a2 - first factor of the second term
      b2 - second factor of the second term
      Returns:
      a1×b1 + a2×b2
      See Also:
    • linearCombination Link icon

      default T linearCombination(double a1, T b1, double a2, T b2)
      Compute a linear combination.
      Parameters:
      a1 - first factor of the first term
      b1 - second factor of the first term
      a2 - first factor of the second term
      b2 - second factor of the second term
      Returns:
      a1×b1 + a2×b2
      See Also:
    • linearCombination Link icon

      T linearCombination(T a1, T b1, T a2, T b2, T a3, T b3)
      Compute a linear combination.
      Parameters:
      a1 - first factor of the first term
      b1 - second factor of the first term
      a2 - first factor of the second term
      b2 - second factor of the second term
      a3 - first factor of the third term
      b3 - second factor of the third term
      Returns:
      a1×b1 + a2×b2 + a3×b3
      See Also:
    • linearCombination Link icon

      default T linearCombination(double a1, T b1, double a2, T b2, double a3, T b3)
      Compute a linear combination.
      Parameters:
      a1 - first factor of the first term
      b1 - second factor of the first term
      a2 - first factor of the second term
      b2 - second factor of the second term
      a3 - first factor of the third term
      b3 - second factor of the third term
      Returns:
      a1×b1 + a2×b2 + a3×b3
      See Also:
    • linearCombination Link icon

      T linearCombination(T a1, T b1, T a2, T b2, T a3, T b3, T a4, T b4)
      Compute a linear combination.
      Parameters:
      a1 - first factor of the first term
      b1 - second factor of the first term
      a2 - first factor of the second term
      b2 - second factor of the second term
      a3 - first factor of the third term
      b3 - second factor of the third term
      a4 - first factor of the fourth term
      b4 - second factor of the fourth term
      Returns:
      a1×b1 + a2×b2 + a3×b3 + a4×b4
      See Also:
    • linearCombination Link icon

      default T linearCombination(double a1, T b1, double a2, T b2, double a3, T b3, double a4, T b4)
      Compute a linear combination.
      Parameters:
      a1 - first factor of the first term
      b1 - second factor of the first term
      a2 - first factor of the second term
      b2 - second factor of the second term
      a3 - first factor of the third term
      b3 - second factor of the third term
      a4 - first factor of the fourth term
      b4 - second factor of the fourth term
      Returns:
      a1×b1 + a2×b2 + a3×b3 + a4×b4
      See Also:
    • ceil Link icon

      default T ceil()
      Get the smallest whole number larger than instance.
      Returns:
      ceil(this)
    • floor Link icon

      default T floor()
      Get the largest whole number smaller than instance.
      Returns:
      floor(this)
    • rint Link icon

      default T rint()
      Get the whole number that is the nearest to the instance, or the even one if x is exactly half way between two integers.
      Returns:
      a double number r such that r is an integer r - 0.5 ≤ this ≤ r + 0.5
    • remainder Link icon

      T remainder(double a)
      IEEE remainder operator.
      Parameters:
      a - right hand side parameter of the operator
      Returns:
      this - n × a where n is the closest integer to this/a
    • remainder Link icon

      T remainder(T a)
      IEEE remainder operator.
      Parameters:
      a - right hand side parameter of the operator
      Returns:
      this - n × a where n is the closest integer to this/a
    • sign Link icon

      default T sign()
      Compute the sign of the instance. The sign is -1 for negative numbers, +1 for positive numbers and 0 otherwise, for Complex number, it is extended on the unit circle (equivalent to z/|z|, with special handling for 0 and NaN)
      Returns:
      -1.0, -0.0, +0.0, +1.0 or NaN depending on sign of a
    • copySign Link icon

      T copySign(T sign)
      Returns the instance with the sign of the argument. A NaN sign argument is treated as positive.
      Parameters:
      sign - the sign for the returned value
      Returns:
      the instance with the same sign as the sign argument
    • copySign Link icon

      default T copySign(double sign)
      Returns the instance with the sign of the argument. A NaN sign argument is treated as positive.
      Parameters:
      sign - the sign for the returned value
      Returns:
      the instance with the same sign as the sign argument
    • isInfinite Link icon

      default boolean isInfinite()
      Check if the instance is infinite.
      Returns:
      true if the instance is infinite
    • isFinite Link icon

      default boolean isFinite()
      Check if the instance is finite (neither infinite nor NaN).
      Returns:
      true if the instance is finite (neither infinite nor NaN)
      Since:
      2.0
    • isNaN Link icon

      default boolean isNaN()
      Check if the instance is Not a Number.
      Returns:
      true if the instance is Not a Number
    • norm Link icon

      default double norm()
      norm.
      Returns:
      norm(this)
      Since:
      2.0
    • abs Link icon

      T abs()
      absolute value.
      Returns:
      abs(this)
    • round Link icon

      default long round()
      Get the closest long to instance real value.
      Returns:
      closest long to FieldElement.getReal()