Package rocks.palaiologos.maja
Class Maja
java.lang.Object
rocks.palaiologos.maja.Maja
A slick numerics-oriented Mathematical library for Java.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleApery's constant - zeta(3).static final doubleSI prefix for 10^-18.static final doubleCatalan's constant.static final doubleSI prefix for 10^-2.static final doubleSI prefix for 10^1.static final doubleSI prefix for 10^-1.static final doubleThe value of e.static final doubleThe epsilon value for double precision numbers.static final doubleThe Euler-Mascheroni constant.static final doubleSI prefix for 10^18.static final doubleFeigenbaum constant.static final doubleSI prefix for 10^-15.static final doubleSI prefix for 10^9.static final doubleGlaisher-Kinkelin constant.static final doubleThe golden ratio.static final doubleGolomb-Dickman constant.static final doubleSI prefix for 10^2.static final ComplexThe imaginary unit.static final doubleKhinchin's constant.static final doubleSI prefix for 10^3.static final doubleThe value of ln(10).static final doubleThe value of ln(2).static final doubleThe value of log2(e).static final doubleSI prefix for 10^6.static final doubleSI prefix for 10^-6.static final doubleSI prefix for 10^-3.static final doubleMills' constant.static final doubleSI prefix for 10^-9.static final doubleThe value of 1/e.static final doubleThe value of 1/pi.static final doubleSI prefix for 10^15.static final doubleThe value of pi.static final doubleThe value of pi/2.static final doubleThe value of pi/4.static final doubleSI prefix for 10^-12.private static final RandomThe random number generator used by this class.static final doubleSI prefix for 10^12.static final doubleThe value of 2*PI.static final doubleSI prefix for 10^-24.static final doubleSI prefix for 10^24.static final doubleSI prefix for 10^-21.static final doubleSI prefix for 10^21. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean[]Numerically finds all roots of a polynomial equation P(z) = 0.static doubleabs(double x) Returns the absolute value of a double precision number.static longabs(long x) Returns the absolute value of a number.static doubleCompute the absolute value of a complex number.static Dualstatic ComplexCompute the absolute values of parts of a complex number.static doubleacos(double x) Returns the value of the inverse cosine of a double precision number.static ComplexCompute the arcus cosine of a complex number.static Dualstatic doubleacosh(double x) Compute the value of the inverse hyperbolic cosine function at x.static ComplexCompute the hyperbolic arccosine of a complex number.static Dualstatic doubleacot(double x) Compute the value of the inverse cotangent (1 / atan(x)) function at x.static ComplexCompute the arcus cotangent of a complex number.static Dualstatic doubleacoth(double x) Compute the value of the inverse hyperbolic cotangent (1 / atanh(x)) function at x.static ComplexCompute the hyperbolic arccotangent of a complex number.static Dualstatic doubleacsc(double x) Compute the value of the inverse cosecant (1 / asin(x)) function at x.static ComplexCompute the arcus cosecant of a complex number.static Dualstatic doubleacsch(double x) Compute the value of the inverse hyperbolic cosecant (1 / asinh(x)) function at x.static ComplexCompute the hyperbolic arccosecant of a complex number.static Dualstatic doubleadd(double x, double y) Adds two double precision numbers together.static ComplexAdd a complex number and a real number.static DualPerform real-dual addition.static ComplexAdd a complex number and a real number.static ComplexAdd two complex numbers together.static DualPerform real-dual addition.static DualPerform dual addition.static double[]airy(double x) Compute the value of the Airy Ai, Ai', Bi and Bi' functions at the specified point.static Complex[]Compute the value of the Airy Ai, Ai', Bi and Bi' functions at the specified point.static doubleairyAi(double x) Compute the value of the Airy Ai function at the specified point.static ComplexCompute the value of the Airy Ai function at the specified point.static Dualstatic doubleairyAip(double x) Compute the value of the Airy Ai function's first derivative at the specified point.static ComplexCompute the value of the Airy Ai function's first derivative at the specified point.static doubleairyBi(double x) Compute the value of the Airy Bi function at the specified point.static ComplexCompute the value of the Airy Bi function at the specified point.static Dualstatic doubleairyBip(double x) Compute the value of the Airy Bi function's first derivative at the specified point.static ComplexCompute the value of the Airy Bi function's first derivative at the specified point.static doubleCompute the arc length of a curve defined by the function f(x) and its derivative df(x) on the interval [a, b].static doubleReturn the argument of a complex number.static doubleasec(double x) Compute the value of the inverse secant (1 / acos(x)) function at x.static ComplexCompute the arcus secant of a complex number.static Dualstatic doubleasech(double x) Compute the value of the inverse hyperbolic secant (1 / acosh(x)) function at x.static ComplexCompute the hyperbolic arcsecant of a complex number.static Dualstatic doubleasin(double x) Returns the value of the inverse sine of a double precision number.static ComplexCompute the arcus sine of a complex number.static Dualstatic doubleasinh(double a) Compute the value of the inverse hyperbolic sine function at x.static ComplexCompute the hyperbolic arcsine of a complex number.static Dualstatic doubleatan(double x) Returns the value of the inverse tangent of a double precision number.static ComplexCompute the arcus tangent of a complex number.static Dualstatic doubleatan2(double y, double x) Returns the value of the inverse tangent of two double precision numbers.static doubleatanh(double a) Compute the value of the inverse hyperbolic tangent function at x.static ComplexCompute the hyperbolic arctangent of a complex number.static Dualstatic intbernoulliBound(int n) Returns an integer b such that |B_n| ≤ 2^b for all Bernoulli numbers B_n.static doublebesselI0(double x) Compute the bessel I0 function at x.static Dualstatic doublebesselI1(double x) Compute the bessel I1 function at x.static doublebesselJ0(double x) Compute the bessel J0 function at x.static Dualstatic doublebesselJ1(double x) Compute the bessel J1 function at x.static Dualstatic doublebesselJn(int n, double x) Compute the bessel Jn function at x.static Dualstatic doublebesselJv(double n, double x) Compute fractional order bessel function of n and x.static Dualstatic doublebesselK0(double x) Compute the bessel K0 function at x.static Dualstatic doublebesselK1(double x) Compute the bessel K1 function at x.static Dualstatic doublebesselKn(int n, double x) Compute the bessel Kn function at x.static Dualstatic doublebesselY0(double x) Compute the bessel Y0 function at x.static Dualstatic doublebesselY1(double x) Compute the bessel Y1 function at x.static doublebesselYn(int n, double x) Compute the bessel Yn function at x.static Dualstatic doublebesselYv(double v, double x) Compute the fractional order bessel Y function of v and x.static Dualstatic doublebeta(double x, double y) Compute the beta function of two values.static DualCompute the beta function of a real and dual number.static ComplexCompute the beta function of two complex numbers.static DualCompute the beta function of a dual and real number.static longbinomial(int n, int k) Compute the binomial coefficient "n choose k".static doublecbrt(double x) Returns the value of the cube root of a double precision number.static ComplexCompute the principal cube root of a complex number.static Dualstatic doubleceil(double x) Returns the value of the smallest integer greater than or equal to a double precision number.static ComplexRounds both the real and imaginary parts of a complex number.static doubleChi(double x) Compute the value of the hyperbolic cosine integral function at x.static ComplexCompute the value of the complex hyperbolic cosine integral Chi(z).static Dualstatic doublechiSquaredQuantile(double p, double df) Computes quantiles for chi-squared probability distribution at probability p .static ComplexTrim insignificant real/imaginary parts (below machine epsilon), round up numbers where the real/imaginary part is very close to an integer.static doubleCi(double x) Compute the value of the cosine integral function at x.static ComplexCompute the value of the complex cosine integral Ci(z) at z.static Dualstatic doubleCin(double x) Compute the value of the cosine integral function at x.static ComplexCompute the value of the complex cosine integral Cin(z) at z.static Complexcis(double x) Compute the value of the cis function of a number.static doubleclamp(double value, double min, double max) Clamp a value in the range [min, max].static longclamp(long value, long min, long max) Clamp a value in the range [min, max].static intcompare(double x, double y) Compare two double precision numbers.static intcompare(long x, long y) Compare two integers.static ComplexCompute the complex conjugate of a complex number.static doublecopySign(double x, double y) Copy the sign of the second argument to the first argument.static longcopySign(long x, long y) Copy the sign of the second argument to the first argument.static ComplexCopy the sign of the second argument to the first argument.static doublecos(double x) Returns the value of the smallest integer greater than or equal to a double precision number.static ComplexCompute the cosine of a complex number.static Dualstatic doublecosh(double x) Returns the hyperbolic cosine of a double precision number.static ComplexCompute the hyperbolic cosine of a complex number.static Dualstatic doublecot(double x) Compute the value of the cotangent (1 / tan(x)) function at x.static ComplexCompute the cotangent of a complex number.static Dualstatic doublecoth(double x) Compute the value of the hyperbolic cotangent (1 / tanh(x)) function at x.static ComplexCompute the hyperbolic cotangent of a complex number.static Dualstatic doublecsc(double x) Compute the value of the cosecant (1 / sin(x)) function at x.static ComplexCompute the cosecant of a complex number.static Dualstatic doublecsch(double x) Compute the value of the hyperbolic cosecant (1 / sinh(x)) function at x.static ComplexCompute the hyperbolic cosecant of a complex number.static Dualstatic doubledawsonMinus(double x) Compute the value of the Dawson function (D-) at x.static ComplexCompute the value of the complex Dawson function (D-) at z.static doubledawsonPlus(double x) Compute the value of the Dawson function (D+) at x.static ComplexCompute the value of the complex Dawson function (D+) at z.static doubledigamma(double x) Compute the digamma function of x.static ComplexCompute the complex digamma function.static Dualstatic doubledilog(double n) Compute the dilogarithm (the value of the Spence function at 1-x) of x.static ComplexCompute the complex dilogarithm of z.static Dualstatic doublediv(double x, double y) Divides two double precision numbers.static ComplexDivide a complex number and a real number.static ComplexDivide a complex number and a real number.static ComplexDivide two complex numbers.static Dualstatic ComplexCompute the value of the exponential integral E1 at the specified point.static doubleEi(double x) Compute the value of the exponential integral at x.static ComplexCompute the exponential integral using a formula that was revealed to me in a dream:static Dualstatic ComplexCompute the value of the complementary exponential integral Ein at the specified point.static ComplexCompute the value of the complex generalised exponential integral E_n(z).static booleaneq(double x, double y) Return true if x == y.static booleaneq(double x, double y, double tol) Return true if x is approximately equal to y.static booleanCompare two numbers for equality.static booleanCompare two numbers for equality.static booleanCompare two numbers for equality.static booleanCompare two complex numbers for equality.static doubleerf(double x) Compute the value of the error function at x.static ComplexCompute the complex error function.static Dualstatic doubleerfc(double x) Compute the value of the complementary error function at x.static ComplexCompute the complex complementary error function.static Dualstatic doubleerfi(double x) Compute the value of the imaginary error function at x.static ComplexCompute the complex imaginary error function.static Dualstatic doubleexp(double x) Returns the value of the exponential function of a double precision number.static ComplexCompute the value of the exponential function of a complex number.static Dualstatic doubleexpm1(double x) Returns the value of the exponential function of a double precision number minus one.static doublefactorial(long n) Return the factorial of n as a double-precision.static floatfastCos(float x) Return a cached value of cos(x) using Raven's method.static floatfastSin(float x) Return a cached value of sin(x) using Raven's method.static longfib(int a) Compute the n-th Fibonacci number using Binet's formula.static doublefloor(double x) Returns the value of the largest integer less than or equal to a double precision number.static ComplexRounds both the real and imaginary parts of a complex number.static doublefma(double a, double b, double c) Returns the value of the fused multiply-add operation.static ComplexReturns the value of the complex fused multiply-add operation.static doublefresnelC(double x) Compute the Fresnel integral C(x).static ComplexCompute the Fresnel C integral on the complex plane.static Dualstatic doublefresnelS(double x) Compute the Fresnel integral S(x).static ComplexCompute the Fresnel S integral on the complex plane.static Dualfrexp(double value) Break floating-point number down into exponent and mantissastatic doublegamma(double x) Compute the gamma function of x.static ComplexCompute the gamma function of a complex number.static Dualstatic doublegammaP(double a, double x) Compute the regularized Gamma P function.static doublegammaQ(double a, double x) Compute the regularized Gamma Q function.static doublegcd(double a, double b) Domain extension of the greatest common division function onto the real line.static longgcd(long a, long b) Compute the greatest common divisor of two integers.static ComplexDomain extension of the greatest common division function onto the complex plane.static booleange(double x, double y) Return true if x >= y.static intgetExponent(double x) Returns the exponent of a double precision number.static booleangt(double x, double y) Return true if x > y.static doublehurwitzZeta(double x, double a) Compute the value of the Hurwitz zeta function at x.static DualhurwitzZeta(double s, Dual a) static ComplexhurwitzZeta(Complex s, Complex a) Compute the Hurwitz zeta function of complex arguments.static doublehypergeo1F1(double a, double b, double x) Computes the Confluent hypergeometric function (1F1) of three arguments.static doublehypergeo1F2(double a, double b, double c, double x) Computes the 1F2 case of the generalised hypergeometric function.static doublehypergeo2F1(double a, double b, double c, double x) Computes the Gaussian hypergeometric function (2F1) of four arguments.static doublehypergeo3F0(double a, double b, double c, double x) Computes the 3F0 case of the generalised hypergeometric function.static doublehypot(double x, double y) Returns the length of the hypotenuse of a right triangle with sides of length x and y.static inticbrt(int x) Return the integer cube root of a number.static longicbrt(long x) Return the long integer cube root of a number.static shorticbrt(short a) Return the short integer cube root of a number.static intilog10(int x) Compute the value of the integer logarithm in base 10 of a numberstatic ComplexIntegrate a C -> C function using the Gauss-Legendre quadrature.static ComplexintegrateGaussLegendreRC(Function<Double, Complex> f, double a, double b, int N) Integrate a monadic function over a finite interval [a,b] using the Gauss-Legendre quadrature.static doubleintegrateGaussLegendreReal(Function<Double, Double> f, double a, double b, int N) Integrate a monadic function over a finite interval [a,b] using the Gauss-Legendre quadrature.static ComplexintegrateSimpsonRC(Function<Double, Complex> f, double a, double b, int N) Integrate a monadic function over a finite interval [a,b] using the Simpson rule.static doubleintegrateSimpsonReal(Function<Double, Double> f, double a, double b, int N) Integrate a monadic function over a finite interval [a,b] using the Simpson rule.static Complex[]Integrate a C -> C function using the Tanh-Sinh quadrature.static Complex[]integrateTanhSinhRC(Function<Double, Complex> f, double a, double b, int N, double eps) Integrate a monadic function over a finite interval [a,b] using the Tanh-Sinh quadrature, especially useful when singularities or infinite derivatives exist at one or both endpoints.static double[]integrateTanhSinhReal(Function<Double, Double> f, double a, double b, int N, double eps) Integrate a monadic function over a finite interval [a,b] using the Tanh-Sinh quadrature, especially useful when singularities or infinite derivatives exist at one or both endpoints.static intipow(int x, int n) Compute the value of integer x^n.static longipow(long x, long n) Compute the value of integer x^n.static shortipow(short x, short n) Compute the value of integer x^n.static booleanisPerfectSquare(long x) Determine whether a number is a perfect square.static booleanisPowerOfTwo(long value) Determine if a value is a power of two.static intisqrt(int x) Compute the integer square root of a number.static intisqrt(long x) Compute the integer square root of a number.static intisqrt(short x) Compute the integer square root of a number.static ComplexCompute the specified branch of the complex Lambert W function of z.static doublelambertW0(double x) Compute Lambert W_0 (x).static Dualstatic doublelambertWm1(double x) Compute Lambert W_(-1) (x).static DuallambertWm1(Dual a) static doublelandau(double x) Compute the Landau distribution function.static doublelandau(double x, double mpv, double sigma, boolean norm) Compute the Landau function with specified most probable value and sigma value.static doublelcm(double a, double b) Domain extension of the least common multiple function onto the real line.static longlcm(long a, long b) Compute the least common multiple of two integers.static ComplexDomain extension of the least common multiple function onto the complex plane.static booleanle(double x, double y) Return true if x <= y.static doublelegendreD(double phi, double k) Compute the Legendre D elliptic integral defined by DLMF §19.2.6static ComplexCompute the Legendre D elliptic integral defined by DLMF §19.2.6static doublelegendreE(double phi, double k) Compute the Legendre E elliptic integral defined by DLMF §19.2.5static ComplexCompute the Legendre E elliptic integral defined by DLMF §19.2.5static doublelegendreF(double phi, double k) Compute the Legendre F elliptic integral defined by DLMF §19.2.4static ComplexCompute the Legendre F elliptic integral defined by DLMF §19.2.4static doublelegendrePi(double phi, double alpha, double k) Compute the Legendre Pi elliptic integral defined by DLMF §19.2.7static ComplexlegendrePi(Complex phi, Complex alpha, Complex k) Compute the Legendre Pi elliptic integral defined by DLMF §19.2.7static doublelerchPhi(double z, double s, double a) Compute the value of the Lerch transcendent function at z, s, a.static ComplexCompute the Lerch transcendent of z, s, and a.static doubleli(double x) Compute the logarithmic integral of x, defined as li(x) = int(1/log t, t=0..x).static ComplexCompute the complex logarithmic integral of z, defined as li(z) = int(1/log t, t=0..z).static Dualstatic doubleliGamma(double a, double x) Compute the value of the lower incomplete gamma function.static ComplexCompute the lower incomplete (non-regularised) gamma function of a complex number.static doublelinearInterpolate(double fromValue, double toValue, double progress) Linearly interpolate between two values.static doublelinearMap(double inRangeStart, double inRangeEnd, double outRangeStart, double outRangeEnd, double value) Linearly map a value from one range to another.static doublelinearNorm(double rangeStart, double rangeEnd, double value) Linearly normalise value from a range.static doublelog(double x) Returns the value of the natural logarithm of a double precision number.static ComplexCompute the natural logarithm of a complex number.static Dualstatic doublelog10(double x) Returns the value of the base 10 logarithm of a double precision number.static doublelog1p(double x) Returns the value of the natural logarithm of a double precision number plus one.static doublelog2(double x) Returns the value of the base 2 logarithm of a double precision number.static double[]logabsgamma(double x) Computes the logarithm of the absolute value of the gamma function of x.static doublelogbeta(double x, double y) Compute the logarihtm of the beta function of two values.static ComplexCompute the logarithm of the beta function in the complex plane.static doubleloggamma(double x) Compute the logarithm of the gamma function of x.static ComplexPrincipal branch of the logarithm of the gamma function.static booleanlt(double x, double y) Return true if x < y.static doublemax(double x, double y) Returns the larger of two numbers (maximum).static doublemin(double x, double y) Returns the smaller of two numbers (minimum).static doublemod(double x, double y) Returns the modulus of two double precision numbers.static longmod(long x, long y) Returns the modulus of two numbers.static doublemul(double x, double y) Multiplies two double precision numbers.static ComplexMultiply a complex number and a real number.static ComplexMultiply a complex number and a real number.static ComplexMultiply two complex numbers.static Dualstatic booleanne(double x, double y) Return true if x != y.static booleanCompare two numbers for inequality.static booleanCompare two numbers for inequality.static booleanCompare two numbers for inequality.static doublenegate(double x) Negate a real number.static ComplexNegate a complex number.static doubleFind a root of a monadic function using the Newton-Raphson method.static doublenextAfter(double x, double y) Returns the value of the double precision number adjacent to the first argument in the direction of the second argument.static doublenextDown(double x) Returns the value of the double precision number adjacent to the first argument in the direction of negative infinity.static longnextPowerOfTwo(long value) Returns the next power of two.static doublenextUp(double x) Returns the value of the double precision number adjacent to the first argument in the direction of positive infinity.static doublenormQuantile(double p) Computes quantiles for standard normal distribution N(0, 1) at probability p.static doublepochhammer(double x, double n) Compute the Pochhammer symbol (x)_n.static doublepochhammer(double x, int n) Compute the Pochhammer symbol (x)_n.static Complexpochhammer(Complex x, double n) Compute the Pochhammer symbol (x)_n.static Complexpochhammer(Complex x, int n) Compute the Pochhammer symbol (x)_n.static Complexpochhammer(Complex x, Complex n) Compute the Pochhammer symbol (x)_n.static doublepolygamma(double n, double x) Compute the value of the n-th polygamma function at x.static Dualstatic ComplexCompute the value of the order-N polygamma function at complex z.static doublepolylog(int n, double x) Compute the polylogarithm of x.static Dualstatic ComplexCompute the polylogarithm of s and z.static doublepow(double x, double y) Returns the value of the first argument raised to the power of the second argument.static doublepow(double x, int z) Compute the value of x^z where x is a double precision floating point number and z is an integer.static ComplexCompute a to the power of b, where a is a double precision number and b is a complex number.static ComplexCompute a to the power of b, where a is a complexstatic ComplexCompute a to the power of b, where a and b are both complex numbers.static Dualstatic doublerandom()Returns a random double precision number in range [0, 1).static doublerandom(double max) Returns a random double precision number in range [0, max).static doublerandom(double min, double max) Returns a random double precision number in range [min, max).static longrandom(long max) Returns a random long integer in range [0, max).static longrandom(long min, long max) Returns a random long integer in range [min, max).static longReturn a random sign (-1 or 1).static doublerem(double x, double y) Returns the remainder that results from dividing two double precision numbers.static ComplexDomain extension of the remainder function onto the complex plane.static doubleroot(double x, int deg) Compute the n-th root of a complex number.static Complex[]Find all n-th roots of a complex number.static longround(double x) Rounds a double precision number to the nearest integer.static ComplexRounds both the real and imaginary parts of a complex number.private static doublesafeLog(double x) static doublescalb(double x, int n) Returns the correctly rounded value of x*2^n.static doublesec(double x) Compute the value of the secant (1 / cos(x)) function at x.static ComplexCompute the secant of a complex number.static Dualstatic doublesech(double x) Compute the value of the hyperbolic secant (1 / cosh(x)) function at x.static ComplexCompute the hyperbolic secant of a complex number.static Dualstatic doubleShi(double x) Compute the value of the hyperbolic sine integral function at x.static ComplexCompute the value of the complex hyperbolic sine integral Shi(z).static Dualstatic double[]ShiChi(double x) Compute both the hyperbolic sine and cosine integral at x.static Complex[]Compute the value of the complex hyperbolic sine integral Shi(z) and complex hyperbolic cosine integral Chi(z).static doublesi(double x) Compute the value of the sine integral function at x.static ComplexCompute the value of the complex sine integral si(z) at z.static doubleSi(double x) Compute the value of the sine integral function at x.static ComplexCompute the value of the complex sine integral Si(z) at z.static Dualstatic doublesignum(double x) Returns the sign of a double precision number.static longsignum(long x) Returns the sign of a number.static ComplexReturns the sign of a complex number.static doublesin(double x) Returns the value of the sine of a double precision number.static ComplexCompute the sine of a complex number.static Dualstatic doublesinc(double x) Returns the sinc function of a double precision number, defined as sin(x) / x, except for x = 0, where sinc(x) = 1.static ComplexReturns the sinc function of a complex number, defined as sin(x) / x, except for x = 0, where sinc(x) = 1.static Dualstatic doublesinh(double x) Returns the hyperbolic sine of a double precision number.static ComplexCompute the hyperbolic sine of a complex number.static Dualstatic doubleCompute the surface area of a solid of revolution created by rotating the function f(x) about the x-axis.static doublesolidVolume(Function<Double, Double> f, double a, double b) Compute the volume of a solid of revolution created by rotating the function f(x) about the x-axis.static doublespence(double n) Compute the Spence function of x.static ComplexCompute the Spence function of z.static Dualstatic doublesqrt(double x) Returns the square root of a double precision number.static ComplexCompute the square root of a complex number.static Dualstatic doublesquash(double x) Compute the value of the logistic sigmoid "squash" function at x.static doublestretch(double x) Compute the value of the inverse of the logistic sigmoid "squash" function at x.static doublestruve(double v, double x) Computes the value of the Struve function of order v at x.static doublestruveL0(double x) Computes the value of the modified Struve function of 0th order.static doublestruveL1(double x) Computes the value of the modified Struve function of 1st order.static doublesub(double x, double y) Subtracts two double precision numbers.static ComplexSubtract a complex number and a real number.static Dualstatic ComplexSubtract a complex number and a real number.static ComplexSubtract two complex numbers from each other.static Dualstatic Dualstatic doubletan(double x) Returns the tangent of a double precision number.static ComplexCompute the tangent of a complex number.static Dualstatic doubletanh(double x) Returns the hyperbolic tangent of a double precision number.static ComplexCompute the hyperbolic tangent of a complex number.static Dualstatic doubletoDegrees(double x) Converts the value to degrees from radians.static doubletoRadians(double x) Converts the value to radians from degrees.static doubletrigamma(double x) Compute the trigamma function of x.static ComplexCompute the complex trigamma function.static Dualstatic doubleuiGamma(double a, double x) Compute the value of the upper incomplete gamma function.static ComplexCompute the upper incomplete (non-regularised) gamma function of a complex number.static doubleulp(double x) Returns the value of the unit in last place (ULP) of a double precision number.static doublezeta(double x) Compute the value of the Riemann zeta function at x.static ComplexCompute the value of the complex Riemann zeta function at z.
-
Field Details
-
DECA
public static final double DECASI prefix for 10^1.- See Also:
-
HECTO
public static final double HECTOSI prefix for 10^2.- See Also:
-
KILO
public static final double KILOSI prefix for 10^3.- See Also:
-
MEGA
public static final double MEGASI prefix for 10^6.- See Also:
-
GIGA
public static final double GIGASI prefix for 10^9.- See Also:
-
TERA
public static final double TERASI prefix for 10^12.- See Also:
-
PETA
public static final double PETASI prefix for 10^15.- See Also:
-
EXA
public static final double EXASI prefix for 10^18.- See Also:
-
ZETTA
public static final double ZETTASI prefix for 10^21.- See Also:
-
YOTTA
public static final double YOTTASI prefix for 10^24.- See Also:
-
DECI
public static final double DECISI prefix for 10^-1.- See Also:
-
CENTI
public static final double CENTISI prefix for 10^-2.- See Also:
-
MILLI
public static final double MILLISI prefix for 10^-3.- See Also:
-
MICRO
public static final double MICROSI prefix for 10^-6.- See Also:
-
NANO
public static final double NANOSI prefix for 10^-9.- See Also:
-
PICO
public static final double PICOSI prefix for 10^-12.- See Also:
-
FEMTO
public static final double FEMTOSI prefix for 10^-15.- See Also:
-
ATTO
public static final double ATTOSI prefix for 10^-18.- See Also:
-
ZEPTO
public static final double ZEPTOSI prefix for 10^-21.- See Also:
-
YOCTO
public static final double YOCTOSI prefix for 10^-24.- See Also:
-
LN2
public static final double LN2The value of ln(2).- See Also:
-
LN10
public static final double LN10The value of ln(10).- See Also:
-
LOG2E
public static final double LOG2EThe value of log2(e).- See Also:
-
PI
public static final double PIThe value of pi.- See Also:
-
PI_2
public static final double PI_2The value of pi/2.- See Also:
-
PI_4
public static final double PI_4The value of pi/4.- See Also:
-
TWO_PI
public static final double TWO_PIThe value of 2*PI.- See Also:
-
ONE_OVER_PI
public static final double ONE_OVER_PIThe value of 1/pi.- See Also:
-
E
public static final double EThe value of e.- See Also:
-
ONE_OVER_E
public static final double ONE_OVER_EThe value of 1/e.- See Also:
-
EPSILON
public static final double EPSILONThe epsilon value for double precision numbers. -
EULER_GAMMA
public static final double EULER_GAMMAThe Euler-Mascheroni constant.- See Also:
-
GOLDEN_RATIO
public static final double GOLDEN_RATIOThe golden ratio.- See Also:
-
APERY_CONSTANT
public static final double APERY_CONSTANTApery's constant - zeta(3).- See Also:
-
GLAISHER_CONSTANT
public static final double GLAISHER_CONSTANTGlaisher-Kinkelin constant.- See Also:
-
CATALAN_CONSTANT
public static final double CATALAN_CONSTANTCatalan's constant.- See Also:
-
GOLOMB_DICKMAN_CONSTANT
public static final double GOLOMB_DICKMAN_CONSTANTGolomb-Dickman constant.- See Also:
-
MILLS_CONSTANT
public static final double MILLS_CONSTANTMills' constant.- See Also:
-
FEIGENBAUM_CONSTANT
public static final double FEIGENBAUM_CONSTANTFeigenbaum constant.- See Also:
-
KHINCHIN_CONSTANT
public static final double KHINCHIN_CONSTANTKhinchin's constant.- See Also:
-
I
The imaginary unit. -
random
The random number generator used by this class.
-
-
Constructor Details
-
Maja
private Maja()
-
-
Method Details
-
add
public static double add(double x, double y) Adds two double precision numbers together.- Parameters:
x-y-- Returns:
- x + y
-
sub
public static double sub(double x, double y) Subtracts two double precision numbers.- Parameters:
x-y-- Returns:
- x - y
-
mul
public static double mul(double x, double y) Multiplies two double precision numbers.- Parameters:
x-y-- Returns:
- x * y
-
div
public static double div(double x, double y) Divides two double precision numbers.- Parameters:
x-y-- Returns:
- x / y
-
mod
public static double mod(double x, double y) Returns the modulus of two double precision numbers.- Parameters:
x-y-- Returns:
- x mod y
-
mod
public static long mod(long x, long y) Returns the modulus of two numbers.- Parameters:
x-y-- Returns:
- x mod y
-
rem
public static double rem(double x, double y) Returns the remainder that results from dividing two double precision numbers.- Parameters:
x-y-- Returns:
- x % y
-
abs
public static double abs(double x) Returns the absolute value of a double precision number.- Parameters:
x-- Returns:
- |x|
- See Also:
-
abs
public static long abs(long x) Returns the absolute value of a number.- Parameters:
x-- Returns:
- |x|
-
acos
public static double acos(double x) Returns the value of the inverse cosine of a double precision number.- Parameters:
x-- Returns:
- cos^-1(x)
- See Also:
-
asin
public static double asin(double x) Returns the value of the inverse sine of a double precision number.- Parameters:
x-- Returns:
- sin^-1(x)
- See Also:
-
atan
public static double atan(double x) Returns the value of the inverse tangent of a double precision number.- Parameters:
x-- Returns:
- tan^-1(x)
- See Also:
-
atan2
public static double atan2(double y, double x) Returns the value of the inverse tangent of two double precision numbers.- Parameters:
y-x-- Returns:
- atan2(y, x)
- See Also:
-
cbrt
public static double cbrt(double x) Returns the value of the cube root of a double precision number.- Parameters:
x-- Returns:
- x^(1/3)
- See Also:
-
ceil
public static double ceil(double x) Returns the value of the smallest integer greater than or equal to a double precision number.- Parameters:
x-- Returns:
- ceil(x)
- See Also:
-
cos
public static double cos(double x) Returns the value of the smallest integer greater than or equal to a double precision number.- Parameters:
x-- Returns:
- ceil(x)
- See Also:
-
cosh
public static double cosh(double x) Returns the hyperbolic cosine of a double precision number.- Parameters:
x-- Returns:
- cosh(x)
- See Also:
-
exp
public static double exp(double x) Returns the value of the exponential function of a double precision number.- Parameters:
x-- Returns:
- e^x
- See Also:
-
expm1
public static double expm1(double x) Returns the value of the exponential function of a double precision number minus one.- Parameters:
x-- Returns:
- e^x - 1
- See Also:
-
floor
public static double floor(double x) Returns the value of the largest integer less than or equal to a double precision number.- Parameters:
x-- Returns:
- floor(x)
- See Also:
-
hypot
public static double hypot(double x, double y) Returns the length of the hypotenuse of a right triangle with sides of length x and y.- Parameters:
x-y-- Returns:
- sqrt(x ^ 2 + y ^ 2)
- See Also:
-
log
public static double log(double x) Returns the value of the natural logarithm of a double precision number.- Parameters:
x-- Returns:
- ln(x)
- See Also:
-
log10
public static double log10(double x) Returns the value of the base 10 logarithm of a double precision number.- Parameters:
x-- Returns:
- log10(x)
- See Also:
-
log1p
public static double log1p(double x) Returns the value of the natural logarithm of a double precision number plus one.- Parameters:
x-- Returns:
- ln(x + 1)
- See Also:
-
log2
public static double log2(double x) Returns the value of the base 2 logarithm of a double precision number.- Parameters:
x-- Returns:
- log2(x)
-
max
public static double max(double x, double y) Returns the larger of two numbers (maximum).- Parameters:
x-y-- Returns:
- max(x, y)
- See Also:
-
min
public static double min(double x, double y) Returns the smaller of two numbers (minimum).- Parameters:
x-y-- Returns:
- min(x, y)
- See Also:
-
pow
public static double pow(double x, double y) Returns the value of the first argument raised to the power of the second argument.- Parameters:
x-y-- Returns:
- x^y
- See Also:
-
signum
public static double signum(double x) Returns the sign of a double precision number.- Parameters:
x-- Returns:
- -1 if x < 0, 0 if x == 0, 1 if x > 0
- See Also:
-
signum
public static long signum(long x) Returns the sign of a number.- Parameters:
x-- Returns:
- -1 if x < 0, 1 if x > 0
-
signum
Returns the sign of a complex number.- Parameters:
x-- Returns:
- A complex number where the real and imaginary parts correspond to the sign of the real and imaginary parts of x.
-
sin
public static double sin(double x) Returns the value of the sine of a double precision number.- Parameters:
x-- Returns:
- sin(x)
- See Also:
-
ceil
Rounds both the real and imaginary parts of a complex number.- Parameters:
x-- Returns:
- ceil(x)
-
floor
Rounds both the real and imaginary parts of a complex number.- Parameters:
x-- Returns:
- floor(x)
-
round
Rounds both the real and imaginary parts of a complex number.- Parameters:
x-- Returns:
- round(x)
-
sinc
public static double sinc(double x) Returns the sinc function of a double precision number, defined as sin(x) / x, except for x = 0, where sinc(x) = 1.- Parameters:
x-- Returns:
- sinc(x)
-
sinc
Returns the sinc function of a complex number, defined as sin(x) / x, except for x = 0, where sinc(x) = 1.- Parameters:
x-- Returns:
- sinc(x)
-
sinh
public static double sinh(double x) Returns the hyperbolic sine of a double precision number.- Parameters:
x-- Returns:
- sinh(x)
- See Also:
-
sqrt
public static double sqrt(double x) Returns the square root of a double precision number.- Parameters:
x-- Returns:
- x^(1/2)
- See Also:
-
tan
public static double tan(double x) Returns the tangent of a double precision number.- Parameters:
x-- Returns:
- tan(x)
- See Also:
-
tanh
public static double tanh(double x) Returns the hyperbolic tangent of a double precision number.- Parameters:
x-- Returns:
- tanh(x)
- See Also:
-
toDegrees
public static double toDegrees(double x) Converts the value to degrees from radians.- Parameters:
x-- Returns:
- x * 180 / PI
- See Also:
-
toRadians
public static double toRadians(double x) Converts the value to radians from degrees.- Parameters:
x-- Returns:
- x * PI / 180
- See Also:
-
ulp
public static double ulp(double x) Returns the value of the unit in last place (ULP) of a double precision number.- Parameters:
x-- Returns:
- ULP(x)
- See Also:
-
fma
public static double fma(double a, double b, double c) Returns the value of the fused multiply-add operation.- Parameters:
a-b-c-- Returns:
- a * b + c
-
fma
Returns the value of the complex fused multiply-add operation.- Parameters:
x-y-z-- Returns:
- x * y + z
-
nextAfter
public static double nextAfter(double x, double y) Returns the value of the double precision number adjacent to the first argument in the direction of the second argument.- Parameters:
x-y-- Returns:
- nextAfter(x, y)
- See Also:
-
nextUp
public static double nextUp(double x) Returns the value of the double precision number adjacent to the first argument in the direction of positive infinity.- Parameters:
x-- Returns:
- nextUp(x)
- See Also:
-
nextDown
public static double nextDown(double x) Returns the value of the double precision number adjacent to the first argument in the direction of negative infinity.- Parameters:
x-- Returns:
- nextDown(x)
- See Also:
-
scalb
public static double scalb(double x, int n) Returns the correctly rounded value of x*2^n.- Parameters:
x-n-- Returns:
- scalb(x, n)
- See Also:
-
copySign
public static double copySign(double x, double y) Copy the sign of the second argument to the first argument.- Parameters:
x-y-- Returns:
- copySign(x, y)
- See Also:
-
copySign
public static long copySign(long x, long y) Copy the sign of the second argument to the first argument.- Parameters:
x-y-- Returns:
- copySign(x, y)
-
copySign
Copy the sign of the second argument to the first argument.- Parameters:
x-y-- Returns:
- copySign(x, y)
-
absparts
Compute the absolute values of parts of a complex number.- Parameters:
x-- Returns:
- |re(x)| + i|im(x)|
-
getExponent
public static int getExponent(double x) Returns the exponent of a double precision number.- Parameters:
x-- Returns:
- exponent(x)
- See Also:
-
round
public static long round(double x) Rounds a double precision number to the nearest integer.- Parameters:
x-- Returns:
- round(x)
- See Also:
-
random
public static double random()Returns a random double precision number in range [0, 1).- Returns:
- random()
-
random
public static double random(double min, double max) Returns a random double precision number in range [min, max).- Parameters:
min-max-- Returns:
- random() * (max - min) + min
-
random
public static long random(long min, long max) Returns a random long integer in range [min, max).- Parameters:
min-max-- Returns:
- random() * (max - min) + min
-
random
public static double random(double max) Returns a random double precision number in range [0, max).- Parameters:
max-- Returns:
- random() * max
-
random
public static long random(long max) Returns a random long integer in range [0, max).- Parameters:
max-- Returns:
- random() * max
-
lt
public static boolean lt(double x, double y) Return true if x < y.- Parameters:
x-y-- Returns:
- x < y
-
le
public static boolean le(double x, double y) Return true if x <= y.- Parameters:
x-y-- Returns:
- x <= y
-
gt
public static boolean gt(double x, double y) Return true if x > y.- Parameters:
x-y-- Returns:
- x > y
-
ge
public static boolean ge(double x, double y) Return true if x >= y.- Parameters:
x-y-- Returns:
- x >= y
-
eq
public static boolean eq(double x, double y) Return true if x == y.- Parameters:
x-y-- Returns:
- x == y
-
ne
public static boolean ne(double x, double y) Return true if x != y.- Parameters:
x-y-- Returns:
- x != y
-
compare
public static int compare(double x, double y) Compare two double precision numbers.- Parameters:
x-y-- Returns:
- 1 if x > y, 0 if x == y, -1 if x < y
-
compare
public static int compare(long x, long y) Compare two integers.- Parameters:
x-y-- Returns:
- 1 if x > y, 0 if x == y, -1 if x < y
-
eq
public static boolean eq(double x, double y, double tol) Return true if x is approximately equal to y.- Parameters:
x-y-tol-- Returns:
- abs(x - y) <= tol
-
isPerfectSquare
public static boolean isPerfectSquare(long x) Determine whether a number is a perfect square.- Parameters:
x-- Returns:
- true if x is a perfect square, false otherwise
-
linearMap
public static double linearMap(double inRangeStart, double inRangeEnd, double outRangeStart, double outRangeEnd, double value) Linearly map a value from one range to another. Input range must not be empty.- Parameters:
inRangeStart- Input range startinRangeEnd- Input range endoutRangeStart- Output range startoutRangeEnd- Output range endvalue- Value to map- Returns:
- Mapped value. Values outside the input range are not clamped to output range
-
linearNorm
public static double linearNorm(double rangeStart, double rangeEnd, double value) Linearly normalise value from a range. Range must not be empty.- Parameters:
rangeStart- Range start normalized to 0rangeEnd- Range end normalized to 1value- Value to normalize- Returns:
- Normalized value. Values outside the range are not clamped to 0 and 1
-
linearInterpolate
public static double linearInterpolate(double fromValue, double toValue, double progress) Linearly interpolate between two values.- Parameters:
fromValue-toValue-progress-- Returns:
- fromValue + (toValue - fromValue) * progress
-
clamp
public static double clamp(double value, double min, double max) Clamp a value in the range [min, max].- Parameters:
value-min-max-- Returns:
- min if value < min, max if value > max, value otherwise
-
clamp
public static long clamp(long value, long min, long max) Clamp a value in the range [min, max].- Parameters:
value-min-max-- Returns:
- min if value < min, max if value > max, value otherwise
-
isPowerOfTwo
public static boolean isPowerOfTwo(long value) Determine if a value is a power of two.- Parameters:
value-- Returns:
- true if value is a power of two, false otherwise
-
nextPowerOfTwo
public static long nextPowerOfTwo(long value) Returns the next power of two. If the number is already a power of two, this function acts as an identity function.- Parameters:
value-- Returns:
- the next power of two
-
randomSign
public static long randomSign()Return a random sign (-1 or 1).- Returns:
- -1 or 1
-
fastSin
public static float fastSin(float x) Return a cached value of sin(x) using Raven's method. The cache is 65KB large.- Parameters:
x- angle in radians, between -2*pi and 2*pi inclusive.- Returns:
- sin(x)
-
fastCos
public static float fastCos(float x) Return a cached value of cos(x) using Raven's method. The cache is 65KB large.- Parameters:
x- angle in radians, between -2*pi and 2*pi inclusive.- Returns:
- cos(x)
-
icbrt
public static int icbrt(int x) Return the integer cube root of a number. If x < 0, -cbrt(-x) is returned.- Parameters:
x-- Returns:
- floor(cbrt ( x))
-
icbrt
public static long icbrt(long x) Return the long integer cube root of a number. If x < 0, -cbrt(-x) is returned.- Parameters:
x-- Returns:
- floor(cbrt ( x))
-
icbrt
public static short icbrt(short a) Return the short integer cube root of a number. If a < 0, -cbrt(-a) is returned.- Parameters:
a-- Returns:
- floor(cbrt ( a))
-
isqrt
public static int isqrt(int x) Compute the integer square root of a number. If x < 0, -isqrt(-x) is returned.- Parameters:
x-- Returns:
- floor(sqrt ( x))
-
isqrt
public static int isqrt(long x) Compute the integer square root of a number. If x < 0, -isqrt(-x) is returned.- Parameters:
x-- Returns:
- floor(sqrt ( x))
-
isqrt
public static int isqrt(short x) Compute the integer square root of a number. If x < 0, -isqrt(-x) is returned.- Parameters:
x-- Returns:
- floor(sqrt ( x))
-
ilog10
public static int ilog10(int x) Compute the value of the integer logarithm in base 10 of a number- Parameters:
x-- Returns:
- floor(log10 ( x))
-
ipow
public static int ipow(int x, int n) Compute the value of integer x^n.- Parameters:
x-n-- Returns:
- x^n.
-
ipow
public static long ipow(long x, long n) Compute the value of integer x^n.- Parameters:
x-n-- Returns:
- x^n.
-
ipow
public static short ipow(short x, short n) Compute the value of integer x^n.- Parameters:
x-n-- Returns:
- x^n.
-
frexp
Break floating-point number down into exponent and mantissa- Parameters:
value-- Returns:
- A pair of the exponent and the mantissa.
-
pow
public static double pow(double x, int z) Compute the value of x^z where x is a double precision floating point number and z is an integer.- Parameters:
x-z-- Returns:
- x^z.
- Throws:
ArithmeticException- in case of overflow.
-
airyAi
public static double airyAi(double x) Compute the value of the Airy Ai function at the specified point.- Parameters:
x-- Returns:
- Ai(x)
-
airyAip
public static double airyAip(double x) Compute the value of the Airy Ai function's first derivative at the specified point.- Parameters:
x-- Returns:
- Ai'(x)
-
airyBi
public static double airyBi(double x) Compute the value of the Airy Bi function at the specified point.- Parameters:
x-- Returns:
- Bi(x)
-
airyBip
public static double airyBip(double x) Compute the value of the Airy Bi function's first derivative at the specified point.- Parameters:
x-- Returns:
- Bi'(x)
-
airy
public static double[] airy(double x) Compute the value of the Airy Ai, Ai', Bi and Bi' functions at the specified point.- Parameters:
x-- Returns:
- a double array of length 4 containing Ai, Ai', Bi and Bi' in that order.
-
gamma
public static double gamma(double x) Compute the gamma function of x.- Parameters:
x-- Returns:
- gamma(x)
-
loggamma
public static double loggamma(double x) Compute the logarithm of the gamma function of x.- Parameters:
x-- Returns:
- log(gamma ( x))
-
digamma
public static double digamma(double x) Compute the digamma function of x.- Parameters:
x-- Returns:
- digamma(x)
-
trigamma
public static double trigamma(double x) Compute the trigamma function of x.- Parameters:
x-- Returns:
- trigamma(x)
-
uiGamma
public static double uiGamma(double a, double x) Compute the value of the upper incomplete gamma function.- Parameters:
a-x-- Returns:
- gamma_u(a, x)
-
liGamma
public static double liGamma(double a, double x) Compute the value of the lower incomplete gamma function.- Parameters:
a-x-- Returns:
- gamma_l(a, x)
-
pochhammer
public static double pochhammer(double x, double n) Compute the Pochhammer symbol (x)_n.- Parameters:
x-n-- Returns:
- (x)_n
-
pochhammer
public static double pochhammer(double x, int n) Compute the Pochhammer symbol (x)_n.- Parameters:
x-n-- Returns:
- (x)_n
-
pochhammer
Compute the Pochhammer symbol (x)_n.- Parameters:
x-n-- Returns:
- (x)_n
-
pochhammer
Compute the Pochhammer symbol (x)_n.- Parameters:
x-n-- Returns:
- (x)_n
-
pochhammer
Compute the Pochhammer symbol (x)_n.- Parameters:
x-n-- Returns:
- (x)_n
-
Ei
public static double Ei(double x) Compute the value of the exponential integral at x.- Parameters:
x-- Returns:
- Ei(x)
-
zeta
public static double zeta(double x) Compute the value of the Riemann zeta function at x.- Parameters:
x-- Returns:
- zeta(x)
-
zeta
Compute the value of the complex Riemann zeta function at z.- Parameters:
z-- Returns:
- zeta(z)
-
hurwitzZeta
public static double hurwitzZeta(double x, double a) Compute the value of the Hurwitz zeta function at x.- Parameters:
x-a-- Returns:
- zeta(x, a)
-
polygamma
public static double polygamma(double n, double x) Compute the value of the n-th polygamma function at x.- Parameters:
n-x-- Returns:
- polygamma(n, x)
-
polygamma
Compute the value of the order-N polygamma function at complex z.- Parameters:
n-z-- Returns:
- polygamma(n, z)
-
beta
public static double beta(double x, double y) Compute the beta function of two values.- Parameters:
x-y-- Returns:
- beta(x, y)
-
logbeta
public static double logbeta(double x, double y) Compute the logarihtm of the beta function of two values. Uses the identity that log(beta(x, y)) = log(gamma(x)) + log(gamma(y)) - log(gamma(x + y)).- Parameters:
x-y-- Returns:
- log(beta ( x, y))
-
factorial
public static double factorial(long n) Return the factorial of n as a double-precision. n must be positive. Faster than using the gamma function.- Parameters:
n-- Returns:
- n!
- Throws:
ArithmeticException- if n is negative
-
dilog
public static double dilog(double n) Compute the dilogarithm (the value of the Spence function at 1-x) of x.- Parameters:
n-- Returns:
- dilog(x)
-
spence
public static double spence(double n) Compute the Spence function of x.- Parameters:
n-- Returns:
- Spence(x)
-
polylog
public static double polylog(int n, double x) Compute the polylogarithm of x.- Parameters:
n-x-- Returns:
- Li_n(x)
-
sec
public static double sec(double x) Compute the value of the secant (1 / cos(x)) function at x.- Parameters:
x-- Returns:
- sec(x)
-
csc
public static double csc(double x) Compute the value of the cosecant (1 / sin(x)) function at x.- Parameters:
x-- Returns:
- csc(x)
-
cot
public static double cot(double x) Compute the value of the cotangent (1 / tan(x)) function at x.- Parameters:
x-- Returns:
- cot(x)
-
sech
public static double sech(double x) Compute the value of the hyperbolic secant (1 / cosh(x)) function at x.- Parameters:
x-- Returns:
- sech(x)
-
csch
public static double csch(double x) Compute the value of the hyperbolic cosecant (1 / sinh(x)) function at x.- Parameters:
x-- Returns:
- csch(x)
-
coth
public static double coth(double x) Compute the value of the hyperbolic cotangent (1 / tanh(x)) function at x.- Parameters:
x-- Returns:
- coth(x)
-
asec
public static double asec(double x) Compute the value of the inverse secant (1 / acos(x)) function at x.- Parameters:
x-- Returns:
- asec(x)
-
acsc
public static double acsc(double x) Compute the value of the inverse cosecant (1 / asin(x)) function at x.- Parameters:
x-- Returns:
- acsc(x)
-
acot
public static double acot(double x) Compute the value of the inverse cotangent (1 / atan(x)) function at x.- Parameters:
x-- Returns:
- acot(x)
-
asinh
public static double asinh(double a) Compute the value of the inverse hyperbolic sine function at x.- Parameters:
a-- Returns:
- asinh(a)
-
safeLog
private static double safeLog(double x) -
acosh
public static double acosh(double x) Compute the value of the inverse hyperbolic cosine function at x.- Parameters:
x-- Returns:
- acosh(x)
-
atanh
public static double atanh(double a) Compute the value of the inverse hyperbolic tangent function at x.- Parameters:
a-- Returns:
- atanh(a)
-
asech
public static double asech(double x) Compute the value of the inverse hyperbolic secant (1 / acosh(x)) function at x.- Parameters:
x-- Returns:
- asech(x)
-
acsch
public static double acsch(double x) Compute the value of the inverse hyperbolic cosecant (1 / asinh(x)) function at x.- Parameters:
x-- Returns:
- acsch(x)
-
acoth
public static double acoth(double x) Compute the value of the inverse hyperbolic cotangent (1 / atanh(x)) function at x.- Parameters:
x-- Returns:
- acoth(x)
-
lambertW0
public static double lambertW0(double x) Compute Lambert W_0 (x).- Parameters:
x-- Returns:
- W_0(x)
-
lambertWm1
public static double lambertWm1(double x) Compute Lambert W_(-1) (x).- Parameters:
x-- Returns:
- W_(- 1) (x)
-
lerchPhi
public static double lerchPhi(double z, double s, double a) Compute the value of the Lerch transcendent function at z, s, a.- Parameters:
z-s-a-- Returns:
- Lerch(z, s, a)
- Throws:
ArithmeticException- if the computation fails unexpectedly due to exceeding the amount of allowed iterations.
-
dawsonPlus
public static double dawsonPlus(double x) Compute the value of the Dawson function (D+) at x.- Parameters:
x-- Returns:
- D+(x)
-
dawsonMinus
public static double dawsonMinus(double x) Compute the value of the Dawson function (D-) at x.- Parameters:
x-- Returns:
- D-(x)
-
erf
public static double erf(double x) Compute the value of the error function at x.- Parameters:
x-- Returns:
- erf(x)
-
erfc
public static double erfc(double x) Compute the value of the complementary error function at x.- Parameters:
x-- Returns:
- erfc(x)
-
erfi
public static double erfi(double x) Compute the value of the imaginary error function at x.- Parameters:
x-- Returns:
- erfi(x)
-
stretch
public static double stretch(double x) Compute the value of the inverse of the logistic sigmoid "squash" function at x.- Parameters:
x-- Returns:
- stretch(x)
-
squash
public static double squash(double x) Compute the value of the logistic sigmoid "squash" function at x.- Parameters:
x-- Returns:
- squash(x)
-
Si
public static double Si(double x) Compute the value of the sine integral function at x.- Parameters:
x-- Returns:
- Si(x)
-
Ci
public static double Ci(double x) Compute the value of the cosine integral function at x.- Parameters:
x-- Returns:
- Ci(x)
-
Shi
public static double Shi(double x) Compute the value of the hyperbolic sine integral function at x.- Parameters:
x-- Returns:
-
Chi
public static double Chi(double x) Compute the value of the hyperbolic cosine integral function at x.- Parameters:
x-- Returns:
- Chi(x)
-
si
public static double si(double x) Compute the value of the sine integral function at x.- Parameters:
x-- Returns:
- si(x)
-
Cin
public static double Cin(double x) Compute the value of the cosine integral function at x.- Parameters:
x-- Returns:
- Cin(x)
-
ShiChi
public static double[] ShiChi(double x) Compute both the hyperbolic sine and cosine integral at x. Return the results in a two-element double precision array.- Parameters:
x-- Returns:
- {Shi(x), Chi(x)}
-
fresnelC
public static double fresnelC(double x) Compute the Fresnel integral C(x).- Parameters:
x-- Returns:
- C(x)
-
fresnelS
public static double fresnelS(double x) Compute the Fresnel integral S(x).- Parameters:
x-- Returns:
- S(x)
-
besselY0
public static double besselY0(double x) Compute the bessel Y0 function at x.- Parameters:
x-- Returns:
- Y0(x)
-
besselY1
public static double besselY1(double x) Compute the bessel Y1 function at x.- Parameters:
x-- Returns:
- Y1(x)
-
besselYn
public static double besselYn(int n, double x) Compute the bessel Yn function at x.- Parameters:
n-x-- Returns:
- Yn(x)
-
besselJ0
public static double besselJ0(double x) Compute the bessel J0 function at x.- Parameters:
x-- Returns:
- J0(x)
-
besselJ1
public static double besselJ1(double x) Compute the bessel J1 function at x.- Parameters:
x-- Returns:
- J1(x)
-
besselJn
public static double besselJn(int n, double x) Compute the bessel Jn function at x.- Parameters:
n-x-- Returns:
- Jn(x)
-
besselI0
public static double besselI0(double x) Compute the bessel I0 function at x.- Parameters:
x-- Returns:
- I0(x)
-
besselI1
public static double besselI1(double x) Compute the bessel I1 function at x.- Parameters:
x-- Returns:
- I1(x)
-
besselK0
public static double besselK0(double x) Compute the bessel K0 function at x.- Parameters:
x-- Returns:
- K0(x)
-
besselK1
public static double besselK1(double x) Compute the bessel K1 function at x.- Parameters:
x-- Returns:
- K1(x)
-
besselKn
public static double besselKn(int n, double x) Compute the bessel Kn function at x.- Parameters:
n-x-- Returns:
- Kn(x)
-
gcd
public static long gcd(long a, long b) Compute the greatest common divisor of two integers.- Parameters:
a-b-- Returns:
- gcd(a, b)
-
gcd
public static double gcd(double a, double b) Domain extension of the greatest common division function onto the real line.- Parameters:
a-b-- Returns:
- gcd(a, b)
-
gcd
Domain extension of the greatest common division function onto the complex plane.- Parameters:
a-b-- Returns:
- gcd(a, b)
-
rem
Domain extension of the remainder function onto the complex plane.- Parameters:
a-b-- Returns:
- a rem b
-
lcm
public static long lcm(long a, long b) Compute the least common multiple of two integers.- Parameters:
a-b-- Returns:
- lcm(a, b)
-
lcm
public static double lcm(double a, double b) Domain extension of the least common multiple function onto the real line.- Parameters:
a-b-- Returns:
- lcm(a, b)
-
lcm
Domain extension of the least common multiple function onto the complex plane.- Parameters:
a-b-- Returns:
- lcm(a, b)
-
fib
public static long fib(int a) Compute the n-th Fibonacci number using Binet's formula. Due to floating point precision issues, this method is only accurate for n ≤= 75.- Parameters:
a-- Returns:
- fib(a)
-
hypergeo2F1
public static double hypergeo2F1(double a, double b, double c, double x) Computes the Gaussian hypergeometric function (2F1) of four arguments.- Parameters:
a-b-c-x-- Returns:
- (2F1)(a, b, c, x)
-
hypergeo1F1
public static double hypergeo1F1(double a, double b, double x) Computes the Confluent hypergeometric function (1F1) of three arguments.- Parameters:
a-b-x-- Returns:
- (1F1)(a, b, x)
-
hypergeo1F2
public static double hypergeo1F2(double a, double b, double c, double x) Computes the 1F2 case of the generalised hypergeometric function.- Parameters:
a-b-c-x-- Returns:
- a double array the approximation and the estimated error of (1F2)(a, b, c x)
-
hypergeo3F0
public static double hypergeo3F0(double a, double b, double c, double x) Computes the 3F0 case of the generalised hypergeometric function.- Parameters:
a-b-c-x-- Returns:
- a double array the approximation and the estimated error of (1F2)(a, b, c x)
-
struve
public static double struve(double v, double x) Computes the value of the Struve function of order v at x.- Parameters:
v- order of the Struve functionx- argument of the Struve function- Returns:
- Struve(v, x)
-
struveL0
public static double struveL0(double x) Computes the value of the modified Struve function of 0th order.- Parameters:
x- argument of the Struve function- Returns:
- StruveL0(x)
-
struveL1
public static double struveL1(double x) Computes the value of the modified Struve function of 1st order.- Parameters:
x- argument of the Struve function- Returns:
- StruveL1(x)
-
logabsgamma
public static double[] logabsgamma(double x) Computes the logarithm of the absolute value of the gamma function of x.- Parameters:
x-- Returns:
- { log(|Gamma(x)|), sign(Gamma(x)) }
- See Also:
-
besselJv
public static double besselJv(double n, double x) Compute fractional order bessel function of n and x.- Parameters:
n-x-- Returns:
- J_n(x)
-
besselYv
public static double besselYv(double v, double x) Compute the fractional order bessel Y function of v and x.- Parameters:
v-x-- Returns:
- Y_n(x)
-
integrateSimpsonReal
Integrate a monadic function over a finite interval [a,b] using the Simpson rule. The number of intervals is given by N and the precision of the final result greatly depends on this parameter.- Parameters:
f- function to integratea- lower boundb- upper boundN- number of intervals, N=10000 tends to give a good approximation in most scenarios.- Returns:
- integral of f over [a,b]
- Throws:
IllegalArgumentException- if N is not a positive integer
-
integrateGaussLegendreReal
public static double integrateGaussLegendreReal(Function<Double, Double> f, double a, double b, int N) Integrate a monadic function over a finite interval [a,b] using the Gauss-Legendre quadrature. The number of intervals is given by N and the precision of the final result greatly depends on this parameter. The computation of an integral using the Gauss-Legendre quadrature involves caching the coefficients required to perform the integration depending on the value of the N parameter. This means that the first call to this method will be slower than subsequent calls with the same value of N. The coefficients are internally cached inside a ConcurrentHashMap.- Parameters:
f- function to integratea- lower boundb- upper boundN- number of intervals, N=6 tends to give a good approximation in most scenarios. N must be between 1 and 30.- Returns:
- integral of f over [a,b]
- Throws:
IllegalArgumentException- if N is not a positive integer
-
integrateTanhSinhReal
public static double[] integrateTanhSinhReal(Function<Double, Double> f, double a, double b, int N, double eps) Integrate a monadic function over a finite interval [a,b] using the Tanh-Sinh quadrature, especially useful when singularities or infinite derivatives exist at one or both endpoints. The Tanh-Sinh quadrature is not as efficient as Gaussian quadrature for smooth integrands.- Parameters:
f- function to integratea- lower boundb- upper boundN- the degree of the quadrature, usually N=6 is sufficienteps- desired precision of the result (usually 1.0e-9 is sufficient)- Returns:
- an array of double values, first of which is the integral of f over [a,b], while the second is the estimated error.
- Throws:
IllegalArgumentException- if N is not a positive integer
-
integrateSimpsonRC
Integrate a monadic function over a finite interval [a,b] using the Simpson rule. The number of intervals is given by N and the precision of the final result greatly depends on this parameter.- Parameters:
f- function to integratea- lower boundb- upper boundN- number of intervals, N=10000 tends to give a good approximation in most scenarios.- Returns:
- integral of f over [a,b]
- Throws:
IllegalArgumentException- if N is not a positive integer
-
integrateGaussLegendreRC
public static Complex integrateGaussLegendreRC(Function<Double, Complex> f, double a, double b, int N) Integrate a monadic function over a finite interval [a,b] using the Gauss-Legendre quadrature. The number of intervals is given by N and the precision of the final result greatly depends on this parameter. The computation of an integral using the Gauss-Legendre quadrature involves caching the coefficients required to perform the integration depending on the value of the N parameter. This means that the first call to this method will be slower than subsequent calls with the same value of N. The coefficients are internally cached inside a ConcurrentHashMap.- Parameters:
f- function to integratea- lower boundb- upper boundN- number of intervals, N=6 tends to give a good approximation in most scenarios. N must be between 1 and 30.- Returns:
- integral of f over [a,b]
- Throws:
IllegalArgumentException- if N is not a positive integer
-
integrateTanhSinhRC
public static Complex[] integrateTanhSinhRC(Function<Double, Complex> f, double a, double b, int N, double eps) Integrate a monadic function over a finite interval [a,b] using the Tanh-Sinh quadrature, especially useful when singularities or infinite derivatives exist at one or both endpoints. The Tanh-Sinh quadrature is not as efficient as Gaussian quadrature for smooth integrands.- Parameters:
f- function to integratea- lower boundb- upper boundN- the degree of the quadrature, usually N=6 is sufficienteps- desired precision of the result (usually 1.0e-9 is sufficient)- Returns:
- an array of double values, first of which is the integral of f over [a,b], while the second is the estimated error.
- Throws:
IllegalArgumentException- if N is not a positive integer
-
binomial
public static long binomial(int n, int k) Compute the binomial coefficient "n choose k".- Parameters:
n- the number of elements, n > 0.k- the number of elements to choose, 0 < k <= n.- Returns:
- n! / (k! * (n-k)!)
- Throws:
IllegalArgumentException- if n <= 0 or k < 0 or k > n.
-
newtonRaphson
public static double newtonRaphson(Function<Double, Double> f, Function<Double, Double> df, double x0, double eps) Find a root of a monadic function using the Newton-Raphson method.- Parameters:
f- the function to find a root fordf- the derivative of the functionx0- the initial guesseps- the desired precision of the result- Returns:
- a root of the function f within the desired precision unless the iteration limit is exceeded.
-
aberth
Numerically finds all roots of a polynomial equation P(z) = 0. There are (n+1) coefficients and n roots. The leading coefficient must not be zero. Errors are returned in a boolean array for each root. Success is indicated by false, i.e. no error. On return each root should be checked against its flag.- Parameters:
coefficients-- Returns:
-
bernoulliBound
public static int bernoulliBound(int n) Returns an integer b such that |B_n| ≤ 2^b for all Bernoulli numbers B_n.- Parameters:
n-- Returns:
-
add
Add two complex numbers together.- Parameters:
a-b-- Returns:
- a + b
-
add
Perform dual addition.- Parameters:
a-b-- Returns:
- a + b
-
add
Perform real-dual addition.- Parameters:
a-b-- Returns:
- a + b
-
add
Perform real-dual addition.- Parameters:
a-b-- Returns:
- a + b
-
sub
-
sub
-
sub
-
mul
-
div
-
sin
-
sec
-
cos
-
csc
-
tan
-
cot
-
exp
-
log
-
pow
-
abs
-
asin
-
acos
-
atan
-
sqrt
-
sinh
-
cosh
-
tanh
-
gamma
-
digamma
-
besselI0
-
besselJ0
-
besselK0
-
besselJ1
-
besselY0
-
besselK1
-
besselJn
-
besselYn
-
besselYv
-
besselKn
-
besselJv
-
airyAi
-
airyBi
-
Chi
-
Shi
-
Ci
-
Si
-
Ei
-
erf
-
dilog
-
acot
-
acoth
-
asec
-
acsc
-
coth
-
sech
-
csch
-
asinh
-
acosh
-
atanh
-
asech
-
acsch
-
cbrt
-
beta
Compute the beta function of a dual and real number. The derivative is taken as d/da beta(a,c).- Parameters:
a-c-- Returns:
-
beta
Compute the beta function of a real and dual number. The derivative is taken as d/dc beta(a,c).- Parameters:
a-c-- Returns:
-
erfc
-
erfi
-
fresnelC
-
fresnelS
-
li
-
sinc
-
spence
-
trigamma
-
polygamma
-
polylog
-
lambertW0
-
lambertWm1
-
hurwitzZeta
-
add
Add a complex number and a real number.- Parameters:
a-b-- Returns:
- a + b
-
add
Add a complex number and a real number.- Parameters:
a-b-- Returns:
- a + b
-
sub
Subtract two complex numbers from each other.- Parameters:
a-b-- Returns:
- a - b
-
sub
Subtract a complex number and a real number.- Parameters:
a-b-- Returns:
- a - b
-
sub
Subtract a complex number and a real number.- Parameters:
a-b-- Returns:
- a - b
-
mul
Multiply two complex numbers.- Parameters:
a-b-- Returns:
- a * b
-
mul
Multiply a complex number and a real number.- Parameters:
a-b-- Returns:
- a * b
-
mul
Multiply a complex number and a real number.- Parameters:
a-b-- Returns:
- a * b
-
div
Divide two complex numbers.- Parameters:
a-b-- Returns:
- a / b
-
div
Divide a complex number and a real number.- Parameters:
a-b-- Returns:
- a / b
-
div
Divide a complex number and a real number.- Parameters:
a-b-- Returns:
- a / b
-
conj
Compute the complex conjugate of a complex number.- Parameters:
a-- Returns:
- conj(a)
-
abs
Compute the absolute value of a complex number.- Parameters:
a-- Returns:
- |a|
-
sqrt
Compute the square root of a complex number.- Parameters:
x-- Returns:
- sqrt(x)
-
exp
Compute the value of the exponential function of a complex number.- Parameters:
x-- Returns:
- exp(x)
-
log
Compute the natural logarithm of a complex number.- Parameters:
x-- Returns:
- ln(x)
-
arg
Return the argument of a complex number.- Parameters:
z-- Returns:
- Arg(z)
-
cis
Compute the value of the cis function of a number.- Parameters:
x-- Returns:
- cos(x) + i * sin(x)
-
eq
Compare two numbers for equality.- Parameters:
a-b-- Returns:
- true if a == b, false otherwise
-
eq
Compare two numbers for equality.- Parameters:
a-b-- Returns:
- true if a == b, false otherwise
-
eq
Compare two numbers for equality.- Parameters:
a-b-- Returns:
- true if a == b, false otherwise
-
ne
Compare two numbers for inequality.- Parameters:
a-b-- Returns:
- true if a != b, false otherwise
-
ne
Compare two numbers for inequality.- Parameters:
a-b-- Returns:
- true if a != b, false otherwise
-
ne
Compare two numbers for inequality.- Parameters:
a-b-- Returns:
- true if a != b, false otherwise
-
eq
Compare two complex numbers for equality.- Parameters:
a-b-tol-- Returns:
- true if a ~= b, false otherwise
-
root
public static double root(double x, int deg) Compute the n-th root of a complex number.- Parameters:
x-deg-- Returns:
- x^(1/deg)
-
root
Find all n-th roots of a complex number.- Parameters:
x-n-- Returns:
- x^(1/n)
-
cbrt
Compute the principal cube root of a complex number.- Parameters:
x-- Returns:
- cbrt(x)
-
sin
Compute the sine of a complex number.- Parameters:
x-- Returns:
- sin(x)
-
cos
Compute the cosine of a complex number.- Parameters:
x-- Returns:
- cos(x)
-
tan
Compute the tangent of a complex number.- Parameters:
x-- Returns:
- tan(x)
-
cot
Compute the cotangent of a complex number.- Parameters:
x-- Returns:
- cot(x)
-
sec
Compute the secant of a complex number.- Parameters:
x-- Returns:
-
csc
Compute the cosecant of a complex number.- Parameters:
x-- Returns:
-
pow
Compute a to the power of b, where a and b are both complex numbers.- Parameters:
a-b-- Returns:
- a^b
-
pow
Compute a to the power of b, where a is a double precision number and b is a complex number.- Parameters:
a-b-- Returns:
- a^b
-
pow
Compute a to the power of b, where a is a complex- Parameters:
a-b-- Returns:
- a^b
-
sinh
Compute the hyperbolic sine of a complex number.- Parameters:
a-- Returns:
- sinh(a)
-
cosh
Compute the hyperbolic cosine of a complex number.- Parameters:
a-- Returns:
- cosh(a)
-
tanh
Compute the hyperbolic tangent of a complex number.- Parameters:
a-- Returns:
- tanh(a)
-
coth
Compute the hyperbolic cotangent of a complex number.- Parameters:
a-- Returns:
- coth(a)
-
sech
Compute the hyperbolic secant of a complex number.- Parameters:
a-- Returns:
- sech(a)
-
csch
Compute the hyperbolic cosecant of a complex number.- Parameters:
a-- Returns:
- csch(a)
-
asin
Compute the arcus sine of a complex number.- Parameters:
a-- Returns:
- asin(a)
-
acos
Compute the arcus cosine of a complex number.- Parameters:
a-- Returns:
- acos(a)
-
atan
Compute the arcus tangent of a complex number.- Parameters:
a-- Returns:
- atan(a)
-
acot
Compute the arcus cotangent of a complex number.- Parameters:
a-- Returns:
- acot(a)
-
acsc
Compute the arcus cosecant of a complex number.- Parameters:
a-- Returns:
- acsc(a)
-
asec
Compute the arcus secant of a complex number.- Parameters:
a-- Returns:
- asec(a)
-
asinh
Compute the hyperbolic arcsine of a complex number.- Parameters:
a-- Returns:
- asinh(a)
-
acosh
Compute the hyperbolic arccosine of a complex number.- Parameters:
a-- Returns:
- acosh(a)
-
atanh
Compute the hyperbolic arctangent of a complex number.- Parameters:
a-- Returns:
- atanh(a)
-
acoth
Compute the hyperbolic arccotangent of a complex number.- Parameters:
a-- Returns:
- acoth(a)
-
asech
Compute the hyperbolic arcsecant of a complex number.- Parameters:
a-- Returns:
- asech(a)
-
negate
Negate a complex number.- Parameters:
x-- Returns:
- -x
-
negate
public static double negate(double x) Negate a real number.- Parameters:
x-- Returns:
- -x
-
acsch
Compute the hyperbolic arccosecant of a complex number.- Parameters:
a-- Returns:
- acsch(a)
-
gamma
Compute the gamma function of a complex number.- Parameters:
a-- Returns:
- gamma(a)
-
beta
Compute the beta function of two complex numbers. Defined as beta(a, b) = gamma(a) * gamma(b) / gamma(a + b)- Parameters:
a-b-- Returns:
- beta(a, b)
- See Also:
-
airyAi
Compute the value of the Airy Ai function at the specified point.- Parameters:
x-- Returns:
- Ai(x)
-
airyAip
Compute the value of the Airy Ai function's first derivative at the specified point.- Parameters:
x-- Returns:
- Ai'(x)
-
airyBi
Compute the value of the Airy Bi function at the specified point.- Parameters:
x-- Returns:
- Bi(x)
-
airyBip
Compute the value of the Airy Bi function's first derivative at the specified point.- Parameters:
x-- Returns:
- Bi'(x)
-
airy
Compute the value of the Airy Ai, Ai', Bi and Bi' functions at the specified point.- Parameters:
x-- Returns:
- a double array of length 4 containing Ai, Ai', Bi and Bi' in that order.
-
e1
Compute the value of the exponential integral E1 at the specified point. For positive values of real x, E1 and Ei relate as -E1(x) = Ei(-x).- Parameters:
x-- Returns:
- E1(x)
-
Ei
Compute the exponential integral using a formula that was revealed to me in a dream:Ei(z) = -E1(-z) - log(-z) + 0.5 (log(z) - log(1/z))
- Parameters:
x-- Returns:
- Ei(x)
-
Ein
Compute the value of the complementary exponential integral Ein at the specified point. For all complex z, Ein and Ei relate as Ein(z) = E1(z) + EulerGamma + ln z.- Parameters:
x-- Returns:
- Ein(x)
- See Also:
-
loggamma
Principal branch of the logarithm of the gamma function. Defined to be log(gamma(x)) for x > 0. Extended to the complex plane by analytic continuation. The function has a single branch cut on the negative real axis.
It is not generally true that log gamma(x) = log(gamma(x)), though the real parts tend to agree. The benefit of not defining loggamma as is that the latter function has a complicated branch cut structure whereas loggamma is analytic except for on the negative real axis.
On the real line, loggamma is related to logabsgamma.
- Parameters:
x-- Returns:
- See Also:
-
logbeta
Compute the logarithm of the beta function in the complex plane. Defined using complex loggamma as logbeta(a, b) = loggamma(a) - loggamma(b) - loggamma(a + b).- Parameters:
a-b-- Returns:
- logbeta(a, b)
- See Also:
-
liGamma
Compute the lower incomplete (non-regularised) gamma function of a complex number.- Parameters:
s-z-- Returns:
- ligamma(s, z)
-
uiGamma
Compute the upper incomplete (non-regularised) gamma function of a complex number.- Parameters:
s-z-- Returns:
- uigamma(s, z)
-
erf
Compute the complex error function.- Parameters:
z-- Returns:
- erf(z)
-
erfc
Compute the complex complementary error function.- Parameters:
z-- Returns:
- erfc(z)
-
erfi
Compute the complex imaginary error function.- Parameters:
z-- Returns:
- erfi(z) = -i erf(iz)
-
dawsonPlus
Compute the value of the complex Dawson function (D+) at z.- Parameters:
z-- Returns:
- D+(z)
-
dawsonMinus
Compute the value of the complex Dawson function (D-) at z.- Parameters:
z-- Returns:
- D-(z)
-
fresnelS
Compute the Fresnel S integral on the complex plane.- Parameters:
z-- Returns:
- FresnelS(z)
-
fresnelC
Compute the Fresnel C integral on the complex plane.- Parameters:
z-- Returns:
- FresnelC(z)
-
digamma
Compute the complex digamma function.- Parameters:
z-- Returns:
- digamma(z)
-
trigamma
Compute the complex trigamma function.- Parameters:
z-- Returns:
- trigamma(z)
-
li
public static double li(double x) Compute the logarithmic integral of x, defined as li(x) = int(1/log t, t=0..x).- Parameters:
x-- Returns:
- li(x)
-
li
Compute the complex logarithmic integral of z, defined as li(z) = int(1/log t, t=0..z).- Parameters:
z-- Returns:
- li(z)
-
Si
Compute the value of the complex sine integral Si(z) at z.- Parameters:
z-- Returns:
- Si(z)
-
si
Compute the value of the complex sine integral si(z) at z.- Parameters:
z-- Returns:
- si(z)
-
Ci
Compute the value of the complex cosine integral Ci(z) at z.- Parameters:
z-- Returns:
- Ci(z)
-
Cin
Compute the value of the complex cosine integral Cin(z) at z.- Parameters:
z-- Returns:
- Cin(z)
-
Shi
Compute the value of the complex hyperbolic sine integral Shi(z).- Parameters:
z-- Returns:
- Shi(z)
-
Chi
Compute the value of the complex hyperbolic cosine integral Chi(z).- Parameters:
z-- Returns:
- Chi(z)
-
ShiChi
Compute the value of the complex hyperbolic sine integral Shi(z) and complex hyperbolic cosine integral Chi(z).- Parameters:
z-- Returns:
- { Shi(z), Chi(z) }
-
en
Compute the value of the complex generalised exponential integral E_n(z). Uses A&S 5.1.45 E_n(z) = z^(n-1) * uiGamma(1-n, z) to perform computation.- Parameters:
n-z-- Returns:
- E_n(z)
-
hurwitzZeta
Compute the Hurwitz zeta function of complex arguments.- Parameters:
s-a-- Returns:
- zeta(s, a)
-
dilog
Compute the complex dilogarithm of z.- Parameters:
z-- Returns:
- dilog(z)
-
spence
Compute the Spence function of z.- Parameters:
z-- Returns:
- spence(z)
-
polylog
Compute the polylogarithm of s and z.- Parameters:
s-z-- Returns:
- polylog(s, z)
- Throws:
ArithmeticException- if the amount of numerical algorithm iterations is exceeded
-
lerchPhi
Compute the Lerch transcendent of z, s, and a. A few things to note:- The implementation may overflow the stack for particularly large, negative values of Re(a). This is being worked on.
- The precision of the output may vary. Worst-case scenario revealed during non-extensive randomised trials is around 0.006% relative error
- Parameters:
z-s-a-- Returns:
- lerch(z, s, a)
-
lambertw
Compute the specified branch of the complex Lambert W function of z.- Parameters:
z-k-- Returns:
- lambertw(z, k)
-
chop
Trim insignificant real/imaginary parts (below machine epsilon), round up numbers where the real/imaginary part is very close to an integer.- Parameters:
z-- Returns:
- iround(z)
-
solidArea
public static double solidArea(Function<Double, Double> f, Function<Double, Double> df, double a, double b) Compute the surface area of a solid of revolution created by rotating the function f(x) about the x-axis. The function f(x) must be continuous and differentiable on the interval [a, b]. The area is computed using the Gauss-Legendre quadrature as 2pi * integral of f(x) * sqrt(1 + df(x)^2) from a to b.- Parameters:
f- the function to rotatedf- the derivative of fa- the lower bound of the intervalb- the upper bound of the interval- Returns:
- the area of the solid of revolution
-
solidVolume
Compute the volume of a solid of revolution created by rotating the function f(x) about the x-axis. The function f(x) must be continuous and differentiable on the interval [a, b]. The volume is computed using the Gauss-Legendre quadrature as pi * integral of f(x)^2 from a to b (the disk method).- Parameters:
f- the function to rotatea- the lower bound of the intervalb- the upper bound of the interval- Returns:
- the volume of the solid of revolution
-
integrateTanhSinhComplex
public static Complex[] integrateTanhSinhComplex(Function<Complex, Complex> f, Complex a, Complex b, int n, double eps) Integrate a C -> C function using the Tanh-Sinh quadrature. Performs integration through a straight line contour from a to b.- Parameters:
f- the function to integratea- the lower bound of the intervalb- the upper bound of the intervaln- the quadrature degreeeps- the desired accuracy- Returns:
- the integral of f from a to b
-
integrateGaussLegendreComplex
public static Complex integrateGaussLegendreComplex(Function<Complex, Complex> f, Complex a, Complex b, int n) Integrate a C -> C function using the Gauss-Legendre quadrature. Performs integration through a straight line contour from a to b.- Parameters:
f- the function to integratea- the lower bound of the intervalb- the upper bound of the intervaln- the quadrature degree- Returns:
- the integral of f from a to b
-
arcLength
Compute the arc length of a curve defined by the function f(x) and its derivative df(x) on the interval [a, b]. The arc length is computed using the Gauss-Legendre quadrature as the integral of sqrt(1 + df(x)^2) from a to b.- Parameters:
df- the derivative of fa- the lower bound of the intervalb- the upper bound of the interval- Returns:
- the arc length of the curve
-
legendreF
public static double legendreF(double phi, double k) Compute the Legendre F elliptic integral defined by DLMF §19.2.4- Parameters:
phi-k-- Returns:
- legendreF(phi, k)
-
legendreE
public static double legendreE(double phi, double k) Compute the Legendre E elliptic integral defined by DLMF §19.2.5- Parameters:
phi-k-- Returns:
- legendreE(phi, k)
-
legendreD
public static double legendreD(double phi, double k) Compute the Legendre D elliptic integral defined by DLMF §19.2.6- Parameters:
phi-k-- Returns:
- legendreD(phi, k)
-
legendrePi
public static double legendrePi(double phi, double alpha, double k) Compute the Legendre Pi elliptic integral defined by DLMF §19.2.7- Parameters:
phi-alpha-k-- Returns:
- legendrePi(phi, alpha, k)
-
legendreF
Compute the Legendre F elliptic integral defined by DLMF §19.2.4- Parameters:
phi-k-- Returns:
- legendreF(phi, k)
-
legendreE
Compute the Legendre E elliptic integral defined by DLMF §19.2.5- Parameters:
phi-k-- Returns:
- legendreE(phi, k)
-
legendreD
Compute the Legendre D elliptic integral defined by DLMF §19.2.6- Parameters:
phi-k-- Returns:
- legendreD(phi, k)
-
legendrePi
Compute the Legendre Pi elliptic integral defined by DLMF §19.2.7- Parameters:
phi-alpha-k-- Returns:
- legendrePi(phi, alpha, k)
-
landau
public static double landau(double x, double mpv, double sigma, boolean norm) Compute the Landau function with specified most probable value and sigma value.- Parameters:
x- the value to evaluate the function atmpv- the most probable valuesigma- width of the distributionnorm- whether to normalize the result- Returns:
- landau(x, mpv, sigma, norm)
-
landau
public static double landau(double x) Compute the Landau distribution function.- Parameters:
x- the value to evaluate the function at- Returns:
- landau(x)
-
gammaP
public static double gammaP(double a, double x) Compute the regularized Gamma P function.- Parameters:
a- orderx- argument- Returns:
- gammaP(a, x)
- Throws:
ArithmeticException- if arguments are outside of the domain or the iteration count is exceeded.
-
gammaQ
public static double gammaQ(double a, double x) Compute the regularized Gamma Q function.- Parameters:
a- orderx- argument- Returns:
- gammaQ(a, x)
- Throws:
ArithmeticException- if arguments are outside of the domain or the iteration count is exceeded.
-
normQuantile
public static double normQuantile(double p) Computes quantiles for standard normal distribution N(0, 1) at probability p.- Parameters:
p- probability between 0 and 1.- Returns:
- quantile value
- Throws:
IllegalArgumentException- if p is not between 0 and 1
-
chiSquaredQuantile
public static double chiSquaredQuantile(double p, double df) Computes quantiles for chi-squared probability distribution at probability p .- Parameters:
p- probability between 0 and 1.df- degrees of freedom- Returns:
- quantile value
- Throws:
IllegalArgumentException- if p is not between 0 and 1
-