Interface AQMath


  • public interface AQMath
    Math

    Math contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions.

    Functions

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      double abs​(double value)
      Returns the absolute value of a double value.
      double acos​(double value)
      Returns the arc cosine of a value; the returned angle is in the range 0.0 through pi.
      double asin​(double value)
      Returns the arc sine of a value; the returned angle is in the range -pi/2 through pi/2.
      double atan​(double value)
      Returns the arc tangent of a value; the returned angle is in the range -pi/2 through pi/2.
      double atan2​(double x, double y)
      Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).
      double cbrt​(double value)
      Returns the cube root of a double value.
      double ceil​(double value)
      Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer.
      double constrain​(double value, double min, double max)
      Constrains a value to not exceed a maximum and minimum value.
      double copySign​(double magnitude, double sign)
      Returns the first floating-point argument with the sign of the second floating-point argument.
      double cos​(double angle)
      Returns the trigonometric cosine of an angle.
      double cosh​(double value)
      Returns the hyperbolic cosine of a double value.
      double exp​(double power)
      Returns Euler's number e raised to the power of a double value.
      double expm1​(double power)
      Returns (e^x) - 1.
      double factorial​(int n)
      Returns n!, the product of the numbers 1,...,n.
      double floor​(double value)
      Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.
      int gcd​(int p, int q)
      Returns the greatest common divisor of the absolute value of two numbers, using the "binary gcd" method which avoids division and modulo operations.
      AQCurve getCurve()  
      double getE()
      Returns the double value that is closer than any other to e, the base of the natural logarithms.
      AQFinancial getFinancial()  
      AQFit getFit()  
      double getPI()
      Returns the value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter.
      AQStat getStat()  
      int hash​(double value)
      Returns an integer hash code representing the given double value.
      double hypot​(double x, double y)
      Returns sqrt(x**2 + y**2) without intermediate overflow or underflow.
      double IEEEremainder​(double v1, double v2)
      Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.
      int lcm​(int a, int b)
      Returns the least common multiple of the absolute value of two numbers, using the formula lcm(a,b) = (a / gcd(a,b)) * b.
      double log​(double value)
      Returns the natural logarithm (base e) of a double value.
      double log10​(double value)
      Returns the base 10 logarithm of a double value.
      double log1p​(double value)
      Returns the natural logarithm of the sum of the argument and 1.
      double max​(double v1, double v2)
      Returns the greater of two double values.
      double min​(double v1, double v2)
      Returns the smaller of two double values.
      double nextAfter​(double start, double direction)
      Returns the floating-point number adjacent to the first argument in the direction of the second argument.
      double nextUp​(double d)
      Returns the floating-point value adjacent to d in the direction of positive infinity.
      double norm​(double value, double low, double high)
      Normalizes a number from another range into a value between 0 and 1.
      double pow​(double a, double b)
      Returns the value of the first argument raised to the power of the second argument.
      double random()
      Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.
      double rint​(double value)
      Returns the double value that is closest in value to the argument and is equal to a mathematical integer.
      long round​(double value)
      Returns the closest long to the argument.
      double scalb​(double d, int scaleFactor)
      Return d x 2**scaleFactor rounded as if performed by a single correctly rounded floating-point multiply to a member of the double value set.
      double signum​(double d)
      Returns the signum function of the argument; zero if the argument is zero, 1.0 if the argument is greater than zero, -1.0 if the argument is less than zero.
      double sin​(double angle)
      Returns the trigonometric sine of an angle.
      double sinh​(double value)
      Returns the hyperbolic sine of a double value.
      double sqrt​(double value)
      Returns the correctly rounded positive square root of a double value.
      double tan​(double angle)
      Returns the trigonometric tangent of an angle.
      double tanh​(double value)
      Returns the hyperbolic tangent of a double value.
      double toDegrees​(double radians)
      Converts an angle measured in radians to an approximately equivalent angle measured in degrees.
      double toRadians​(double degrees)
      Converts an angle measured in degrees to an approximately equivalent angle measured in radians.
      double ulp​(double d)
      Returns the size of an ulp of the argument.
    • Method Detail

      • abs

        double abs​(double value)
        Returns the absolute value of a double value.
        Parameters:
        value - The value to use in the computation; required.
        Returns:
        The absolute value of a double value specified.
      • cbrt

        double cbrt​(double value)
        Returns the cube root of a double value.
        Parameters:
        value - The value to use in the computation; required.
        Returns:
        The cube root of the number specified.
      • ceil

        double ceil​(double value)
        Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer.
        Parameters:
        value - The value to use in the computation; required.
        Returns:
        The smallest double value that is greater than or equal to the argument and is equal to a mathematical integer.
      • constrain

        double constrain​(double value,
                         double min,
                         double max)
        Constrains a value to not exceed a maximum and minimum value.
        Parameters:
        value - The value to use in the computation; required.
        min - The minimum value; required.
        max - The maximum value; required.
        Returns:
        Returns a value not to exceed the maximum or minimum value.
      • copySign

        double copySign​(double magnitude,
                        double sign)
        Returns the first floating-point argument with the sign of the second floating-point argument.
        Parameters:
        magnitude - The parameter providing the magnitude of the result.
        sign - The parameter providing the sign of the result.
        Returns:
        A value with the magnitude of magnitude and the sign of sign.
      • exp

        double exp​(double power)
        Returns Euler's number e raised to the power of a double value.
        Parameters:
        power - The exponent to raise e to.
        Returns:
        The value e^a, where e is the base of the natural logarithms.
      • expm1

        double expm1​(double power)
        Returns (e^x) - 1. Note that for values of x near 0, the exact sum of expm1(x) + 1 is much closer to the true result of ex than exp(x).
        Parameters:
        power - The exponent to raise e to in the computation of e^x -1.
        Returns:
        value
      • factorial

        double factorial​(int n)
        Returns n!, the product of the numbers 1,...,n.
        Parameters:
        n - A integer to use in the computation.
        Returns:
        The factorial value.
      • floor

        double floor​(double value)
        Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.
        Parameters:
        value - The value to use in the computation; required.
        Returns:
        The largest (closest to positive infinity) floating-point value that less than or equal to the argument and is equal to a mathematical integer.
      • gcd

        int gcd​(int p,
                int q)
        Returns the greatest common divisor of the absolute value of two numbers, using the "binary gcd" method which avoids division and modulo operations.
        Parameters:
        p - A non-zero number; required;
        q - A non-zero number; required;
        Returns:
        The greatest common divisor, never zero.
      • getE

        double getE()
        Returns the double value that is closer than any other to e, the base of the natural logarithms.
        Returns:
        The double value that is closer then any other to the base of the natural logarithms.
      • hash

        int hash​(double value)
        Returns an integer hash code representing the given double value.
        Parameters:
        value - The value to be hashed; required.
        Returns:
        The hash code;
      • hypot

        double hypot​(double x,
                     double y)
        Returns sqrt(x**2 + y**2) without intermediate overflow or underflow.
        Parameters:
        x - A value; required
        y - A value; required;
        Returns:
        sqrt(x**2 + y**2) without intermediate overflow or underflow.
      • IEEEremainder

        double IEEEremainder​(double v1,
                             double v2)
        Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.
        Parameters:
        v1 - The dividend.
        v2 - The divisor.
        Returns:
        The remainder when f1 is divided by f2.
      • lcm

        int lcm​(int a,
                int b)
        Returns the least common multiple of the absolute value of two numbers, using the formula lcm(a,b) = (a / gcd(a,b)) * b.
        Parameters:
        a - The first integer value.
        b - The second integer value.
        Returns:
        the least common multiple between a and b.
      • log

        double log​(double value)
        Returns the natural logarithm (base e) of a double value.
        Parameters:
        value - A value; required.
        Returns:
        The value ln(value), the natural logarithm of value.
      • log10

        double log10​(double value)
        Returns the base 10 logarithm of a double value.
        Parameters:
        value - A value; required.
        Returns:
        the base 10 logarithm of value.
      • log1p

        double log1p​(double value)
        Returns the natural logarithm of the sum of the argument and 1.
        Parameters:
        value - A value; required.
        Returns:
        The value ln(x + 1), the natural log of x + 1.
      • max

        double max​(double v1,
                   double v2)
        Returns the greater of two double values.
        Parameters:
        v1 - A value.
        v2 - Another value.
        Returns:
        The larger of v1 and v2.
      • min

        double min​(double v1,
                   double v2)
        Returns the smaller of two double values.
        Parameters:
        v1 - A value.
        v2 - Another value.
        Returns:
        The smaller of v1 and v2.
      • nextAfter

        double nextAfter​(double start,
                         double direction)
        Returns the floating-point number adjacent to the first argument in the direction of the second argument.
        Parameters:
        start - The starting floating-point value.
        direction - The value indicating which of start's neighbors or start should be returned
        Returns:
        The floating-point number adjacent to start in the direction of direction.
      • nextUp

        double nextUp​(double d)
        Returns the floating-point value adjacent to d in the direction of positive infinity.
        Parameters:
        d - The starting floating-point value.
        Returns:
        value
      • norm

        double norm​(double value,
                    double low,
                    double high)
        Normalizes a number from another range into a value between 0 and 1. Numbers outside the range are not clamped to 0 and 1.
        Parameters:
        value - Value
        low - Low
        high - High
        Returns:
        value
      • pow

        double pow​(double a,
                   double b)
        Returns the value of the first argument raised to the power of the second argument.
        Parameters:
        a - The base.
        b - The exponent.
        Returns:
        The value a^b
      • random

        double random()
        Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.
        Returns:
        A pseudorandom double greater than or equal to 0.0 and less than 1.0.
      • rint

        double rint​(double value)
        Returns the double value that is closest in value to the argument and is equal to a mathematical integer.
        Parameters:
        value - A double value.
        Returns:
        The closest floating-point value to a that is equal to a mathematical integer.
      • round

        long round​(double value)
        Returns the closest long to the argument.
        Parameters:
        value - A floating-point value to be rounded to an integer.
        Returns:
        The value of the argument rounded to the nearest int value.
      • scalb

        double scalb​(double d,
                     int scaleFactor)
        Return d x 2**scaleFactor rounded as if performed by a single correctly rounded floating-point multiply to a member of the double value set.
        Parameters:
        d - The number to be scaled by a power of two.
        scaleFactor - power of 2 used to scale d
        Returns:
        d x 2^scaleFactor
      • signum

        double signum​(double d)
        Returns the signum function of the argument; zero if the argument is zero, 1.0 if the argument is greater than zero, -1.0 if the argument is less than zero.
        Parameters:
        d - The floating-point value whose signum is to be returned.
        Returns:
        The signum function of the argument.
      • sqrt

        double sqrt​(double value)
        Returns the correctly rounded positive square root of a double value.
        Parameters:
        value - A value.
        Returns:
        The positive square root of a. If the argument is NaN or less than zero, the result is NaN.
      • ulp

        double ulp​(double d)
        Returns the size of an ulp of the argument. An ulp of a double value is the positive distance between this floating-point value and the double value next larger in magnitude.
        Parameters:
        d - The floating-point value whose ulp is to be returned.
        Returns:
        The size of an ulp of the argument.
      • getPI

        double getPI()
        Returns the value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter.
        Returns:
        the value if PI
      • acos

        double acos​(double value)
        Returns the arc cosine of a value; the returned angle is in the range 0.0 through pi.
        Parameters:
        value - The value whose arc cosine is to be returned.
        Returns:
        The arc cosine of the argument.
      • asin

        double asin​(double value)
        Returns the arc sine of a value; the returned angle is in the range -pi/2 through pi/2.
        Parameters:
        value - The value whose arc sine is to be returned.
        Returns:
        The arc sine of the argument.
      • atan

        double atan​(double value)
        Returns the arc tangent of a value; the returned angle is in the range -pi/2 through pi/2.
        Parameters:
        value - The value whose arc tangent is to be returned.
        Returns:
        The arc tangent of the argument.
      • atan2

        double atan2​(double x,
                     double y)
        Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).
        Parameters:
        x - The ordinate coordinate.
        y - The abscissa coordinate.
        Returns:
        The theta component of the point (r, theta) in polar coordinates that corresponds to the point (x, y) in Cartesian coordinates.
      • cos

        double cos​(double angle)
        Returns the trigonometric cosine of an angle.
        Parameters:
        angle - An angle, in radians.
        Returns:
        The cosine of the argument.
      • cosh

        double cosh​(double value)
        Returns the hyperbolic cosine of a double value.
        Parameters:
        value - The number whose hyperbolic cosine is to be returned.
        Returns:
        The hyperbolic cosine of value.
      • sin

        double sin​(double angle)
        Returns the trigonometric sine of an angle.
        Parameters:
        angle - An angle, in radians.
        Returns:
        The sine of the argument.
      • sinh

        double sinh​(double value)
        Returns the hyperbolic sine of a double value.
        Parameters:
        value - The number whose hyperbolic sine is to be returned.
        Returns:
        The hyperbolic sine of value.
      • tan

        double tan​(double angle)
        Returns the trigonometric tangent of an angle.
        Parameters:
        angle - An angle, in radians.
        Returns:
        The tangent of the argument.
      • tanh

        double tanh​(double value)
        Returns the hyperbolic tangent of a double value.
        Parameters:
        value - The number whose hyperbolic tangent is to be returned.
        Returns:
        The hyperbolic tangent of value.
      • toDegrees

        double toDegrees​(double radians)
        Converts an angle measured in radians to an approximately equivalent angle measured in degrees.
        Parameters:
        radians - An angle, in radians.
        Returns:
        The measurement of the angle radians in degrees.
      • toRadians

        double toRadians​(double degrees)
        Converts an angle measured in degrees to an approximately equivalent angle measured in radians.
        Parameters:
        degrees - An angle, in degrees.
        Returns:
        The measurement of the angle degrees in radians.