Package uk.ac.starlink.ttools.func
Class Maths
- java.lang.Object
-
- uk.ac.starlink.ttools.func.Maths
-
public class Maths extends java.lang.ObjectStandard mathematical and trigonometric functions. Trigonometric functions work with angles in radians.- Since:
- 2 Sep 2004
- Author:
- Mark Taylor (Starlink)
-
-
Field Summary
Fields Modifier and Type Field Description static doubleEEuler's number e, the base of natural logarithms.static doubleInfinityPositive infinite floating point value.static doubleNaNNot-a-Number floating point value.static doublePIPi, the ratio of the circumference of a circle to its diameter.static doubleRANDOMEvaluates to a random number in the range 0<=x<1.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doubleacos(double x)Arc cosine of an angle.static doubleacosh(double x)Inverse hyperbolic cosine.static doubleasin(double x)Arc sine of an angle.static doubleasinh(double x)Inverse hyperbolic sine.static doubleatan(double x)Arc tangent of an angle.static doubleatan2(double y, double x)Converts rectangular coordinates (x,y) to polar (r,theta).static doubleatanh(double x)Inverse hyperbolic tangent.static doublecos(double theta)Cosine of an angle.static doublecosh(double x)Hyperbolic cosine.static doubleexp(double x)Euler's number e raised to a power.static doubleexp10(double x)Power of 10.static doublehypot(double... xs)Returns the square root of the sum of squares of its arguments.static doubleln(double x)Natural logarithm.static doublelog10(double x)Logarithm to base 10.static doublepow(double a, double b)Exponentiation.static doublesin(double theta)Sine of an angle.static doublesinh(double x)Hyperbolic sine.static doublesqrt(double x)Square root.static doublesquare(double x)Raise to the power 2.static doubletan(double theta)Tangent of an angle.static doubletanh(double x)Hyperbolic tangent.
-
-
-
Field Detail
-
E
public static final double E
Euler's number e, the base of natural logarithms.- See Also:
- Constant Field Values
-
PI
public static final double PI
Pi, the ratio of the circumference of a circle to its diameter.- See Also:
- Constant Field Values
-
Infinity
public static final double Infinity
Positive infinite floating point value.- See Also:
- Constant Field Values
-
NaN
public static final double NaN
Not-a-Number floating point value. Use with care; arithmetic and logical operations behave in strange ways near NaN (for instance,NaN!=NaN). For most purposes this is equivalent to the blank value.- See Also:
- Constant Field Values
-
RANDOM
public static final double RANDOM
Evaluates to a random number in the range 0<=x<1. This is different for each cell of the table. The quality of the randomness may not be particularly good.- See Also:
- Constant Field Values
-
-
Method Detail
-
sin
public static double sin(double theta)
Sine of an angle.- Parameters:
theta- an angle, in radians.- Returns:
- the sine of the argument.
-
cos
public static double cos(double theta)
Cosine of an angle.- Parameters:
theta- an angle, in radians.- Returns:
- the cosine of the argument.
-
tan
public static double tan(double theta)
Tangent of an angle.- Parameters:
theta- an angle, in radians.- Returns:
- the tangent of the argument.
-
asin
public static double asin(double x)
Arc sine of an angle. The result is in the range of -pi/2 through pi/2.- Parameters:
x- the value whose arc sine is to be returned.- Returns:
- the arc sine of the argument (radians)
-
acos
public static double acos(double x)
Arc cosine of an angle. The result is in the range of 0.0 through pi.- Parameters:
x- the value whose arc cosine is to be returned.- Returns:
- the arc cosine of the argument (radians)
-
atan
public static double atan(double x)
Arc tangent of an angle. The result is in the range of -pi/2 through pi/2.- Parameters:
x- the value whose arc tangent is to be returned.- Returns:
- the arc tangent of the argument (radians)
-
ln
public static double ln(double x)
Natural logarithm.- Parameters:
x- argument- Returns:
- loge(x)
-
exp
public static double exp(double x)
Euler's number e raised to a power.- Parameters:
x- the exponent to raise e to.- Returns:
- the value ex, where e is the base of the natural logarithms.
-
log10
public static double log10(double x)
Logarithm to base 10.- Parameters:
x- argument- Returns:
- log10(x)
-
exp10
public static double exp10(double x)
Power of 10. This convenience function is identical topow(10,x).- Parameters:
x- argument- Returns:
- 10x
-
sqrt
public static double sqrt(double x)
Square root. The result is correctly rounded and positive.- Parameters:
x- a value.- Returns:
- the positive square root of
x. If the argument is NaN or less than zero, the result is NaN.
-
square
public static double square(double x)
Raise to the power 2.- Parameters:
x- a value- Returns:
- x * x
-
hypot
public static double hypot(double... xs)
Returns the square root of the sum of squares of its arguments. In the 2-argument case, doing it like this may avoid intermediate overflow or underflow.- Parameters:
xs- one or more numeric values- Returns:
- sqare root of sum of squares of arguments
- Examples:
hypot(3,4) = 5,hypot(2,2,2,2) = 4
-
atan2
public static double atan2(double y, double x)Converts rectangular coordinates (x,y) to polar (r,theta). This method computes the phasethetaby computing an arc tangent ofy/xin the range of -pi to pi.- Parameters:
y- the ordinate coordinatex- the abscissa coordinate- Returns:
- the
thetacomponent (radians) of the point (r,theta) in polar coordinates that corresponds to the point (x,y) in Cartesian coordinates.
-
pow
public static double pow(double a, double b)Exponentiation. The result is the value of the first argument raised to the power of the second argument.- Parameters:
a- the base.b- the exponent.- Returns:
- the value
ab.
-
sinh
public static double sinh(double x)
Hyperbolic sine.- Parameters:
x- parameter- Returns:
- result
-
cosh
public static double cosh(double x)
Hyperbolic cosine.- Parameters:
x- parameter- Returns:
- result
-
tanh
public static double tanh(double x)
Hyperbolic tangent.- Parameters:
x- parameter- Returns:
- result
-
asinh
public static double asinh(double x)
Inverse hyperbolic sine.- Parameters:
x- parameter- Returns:
- result
-
acosh
public static double acosh(double x)
Inverse hyperbolic cosine.- Parameters:
x- parameter- Returns:
- result
-
atanh
public static double atanh(double x)
Inverse hyperbolic tangent.- Parameters:
x- parameter- Returns:
- result
-
-