math

package
v0.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const LLGoPackage = "py.math"

Variables

Functions

func Acos added in v0.8.2

func Acos(x *py.Object) *py.Object

Return the arc cosine (measured in radians) of x.

The result is between 0 and pi.

func Acosh added in v0.8.2

func Acosh(x *py.Object) *py.Object

Return the inverse hyperbolic cosine of x.

func Asin added in v0.8.2

func Asin(x *py.Object) *py.Object

Return the arc sine (measured in radians) of x.

The result is between -pi/2 and pi/2.

func Asinh added in v0.8.2

func Asinh(x *py.Object) *py.Object

Return the inverse hyperbolic sine of x.

func Atan added in v0.8.2

func Atan(x *py.Object) *py.Object

Return the arc tangent (measured in radians) of x.

The result is between -pi/2 and pi/2.

func Atan2 added in v0.8.2

func Atan2(y *py.Object, x *py.Object) *py.Object

Return the arc tangent (measured in radians) of y/x.

Unlike atan(y/x), the signs of both x and y are considered.

func Atanh added in v0.8.2

func Atanh(x *py.Object) *py.Object

Return the inverse hyperbolic tangent of x.

func Cbrt added in v0.8.2

func Cbrt(x *py.Object) *py.Object

Return the cube root of x.

func Ceil added in v0.8.2

func Ceil(x *py.Object) *py.Object

Return the ceiling of x as an Integral.

This is the smallest integer >= x.

func Comb added in v0.8.2

func Comb(n *py.Object, k *py.Object) *py.Object

Number of ways to choose k items from n items without repetition and without order.

Evaluates to n! / (k! * (n - k)!) when k <= n and evaluates to zero when k > n.

Also called the binomial coefficient because it is equivalent to the coefficient of k-th term in polynomial expansion of the expression (1 + x)**n.

Raises TypeError if either of the arguments are not integers. Raises ValueError if either of the arguments are negative.

func Copysign added in v0.8.2

func Copysign(x *py.Object, y *py.Object) *py.Object

Return a float with the magnitude (absolute value) of x but the sign of y.

On platforms that support signed zeros, copysign(1.0, -0.0) returns -1.0.

func Cos added in v0.8.2

func Cos(x *py.Object) *py.Object

Return the cosine of x (measured in radians).

func Cosh added in v0.8.2

func Cosh(x *py.Object) *py.Object

Return the hyperbolic cosine of x.

func Degrees added in v0.8.2

func Degrees(x *py.Object) *py.Object

Convert angle x from radians to degrees.

func Dist added in v0.8.2

func Dist(p *py.Object, q *py.Object) *py.Object

Return the Euclidean distance between two points p and q.

The points should be specified as sequences (or iterables) of coordinates. Both inputs must have the same dimension.

Roughly equivalent to:

sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))

func Erf added in v0.8.2

func Erf(x *py.Object) *py.Object

Error function at x.

func Erfc added in v0.8.2

func Erfc(x *py.Object) *py.Object

Complementary error function at x.

func Exp added in v0.8.2

func Exp(x *py.Object) *py.Object

Return e raised to the power of x.

func Exp2 added in v0.8.2

func Exp2(x *py.Object) *py.Object

Return 2 raised to the power of x.

func Expm1 added in v0.8.2

func Expm1(x *py.Object) *py.Object

Return exp(x)-1.

This function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x.

func Fabs added in v0.8.2

func Fabs(x *py.Object) *py.Object

Return the absolute value of the float x.

func Factorial added in v0.8.2

func Factorial(n *py.Object) *py.Object

Find n!.

Raise a ValueError if x is negative or non-integral.

func Floor added in v0.8.2

func Floor(x *py.Object) *py.Object

Return the floor of x as an Integral.

This is the largest integer <= x.

func Fmod added in v0.8.2

func Fmod(x *py.Object, y *py.Object) *py.Object

Return fmod(x, y), according to platform C.

x % y may differ.

func Frexp added in v0.8.2

func Frexp(x *py.Object) *py.Object

Return the mantissa and exponent of x, as pair (m, e).

m is a float and e is an int, such that x = m * 2.**e. If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0.

func Fsum added in v0.8.2

func Fsum(seq *py.Object) *py.Object

Return an accurate floating point sum of values in the iterable seq.

Assumes IEEE-754 floating point arithmetic.

func Gamma added in v0.8.2

func Gamma(x *py.Object) *py.Object

Gamma function at x.

func Gcd added in v0.8.2

func Gcd(__llgo_va_list ...interface{}) *py.Object

Greatest Common Divisor.

func Hypot added in v0.8.2

func Hypot(coordinates ...*py.Object) *py.Object

Return the Euclidean norm, sqrt(sum(x**2 for x in coordinates)). This is the length of the vector from the origin to the point given by the coordinates.

func Isfinite added in v0.8.2

func Isfinite(x *py.Object) *py.Object

Return True if x is neither an infinity nor a NaN, and False otherwise.

func Isinf added in v0.8.2

func Isinf(x *py.Object) *py.Object

Return True if x is a positive or negative infinity, and False otherwise.

func Isnan added in v0.8.2

func Isnan(x *py.Object) *py.Object

Return True if x is a NaN (not a number), and False otherwise.

func Isqrt added in v0.8.2

func Isqrt(n *py.Object) *py.Object

Return the integer part of the square root of the input.

func Lcm added in v0.8.2

func Lcm(__llgo_va_list ...interface{}) *py.Object

Least Common Multiple.

func Ldexp added in v0.8.2

func Ldexp(x *py.Object, i *py.Object) *py.Object

Return x * (2**i).

This is essentially the inverse of frexp().

func Lgamma added in v0.8.2

func Lgamma(x *py.Object) *py.Object

Natural logarithm of absolute value of Gamma function at x.

func Log added in v0.8.2

func Log(x *py.Object) *py.Object

With one argument, return the natural logarithm of x (to base e).

func Log10 added in v0.8.2

func Log10(x *py.Object) *py.Object

Return the base 10 logarithm of x.

func Log1p added in v0.8.2

func Log1p(x *py.Object) *py.Object

Return the natural logarithm of 1+x (base e). The result is calculated in a way which is accurate for x near zero.

func Log2 added in v0.8.2

func Log2(x *py.Object) *py.Object

Return the base 2 logarithm of x.

func LogOf added in v0.8.2

func LogOf(x, base *py.Object) *py.Object

With two arguments, return the logarithm of x to the given base, calculated as log(x)/log(base).

func Modf added in v0.8.2

func Modf(x *py.Object) *py.Object

Return the fractional and integer parts of x.

Both results carry the sign of x and are floats.

func Nextafter added in v0.8.2

func Nextafter(x *py.Object, y *py.Object) *py.Object

Return the floating-point value the given number of steps after x towards y.

If steps is not specified or is None, it defaults to 1.

Raises a TypeError, if x or y is not a double, or if steps is not an integer. Raises ValueError if steps is negative.

func Perm added in v0.8.2

func Perm(n *py.Object, k *py.Object) *py.Object

Number of ways to choose k items from n items without repetition and with order.

Evaluates to n! / (n - k)! when k <= n and evaluates to zero when k > n.

If k is not specified or is None, then k defaults to n and the function returns n!.

Raises TypeError if either of the arguments are not integers. Raises ValueError if either of the arguments are negative.

func Pow added in v0.8.2

func Pow(x *py.Object, y *py.Object) *py.Object

Return x**y (x to the power of y).

func Prod added in v0.8.2

func Prod(iterable *py.Object) *py.Object

Calculate the product of all the elements in the input iterable.

The default start value for the product is 1.

When the iterable is empty, return the start value. This function is intended specifically for use with numeric values and may reject non-numeric types.

func Radians added in v0.8.2

func Radians(x *py.Object) *py.Object

Convert angle x from degrees to radians.

func Remainder added in v0.8.2

func Remainder(x *py.Object, y *py.Object) *py.Object

Difference between x and the closest integer multiple of y.

Return x - n*y where n*y is the closest integer multiple of y. In the case where x is exactly halfway between two multiples of y, the nearest even value of n is used. The result is always exact.

func Sin added in v0.8.2

func Sin(x *py.Object) *py.Object

Return the sine of x (measured in radians).

func Sinh added in v0.8.2

func Sinh(x *py.Object) *py.Object

Return the hyperbolic sine of x.

func Sqrt

func Sqrt(x *py.Object) *py.Object

Return the square root of x.

func Sumprod added in v0.8.2

func Sumprod(p *py.Object, q *py.Object) *py.Object

Return the sum of products of values from two iterables p and q.

Roughly equivalent to:

sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))

For float and mixed int/float inputs, the intermediate products and sums are computed with extended precision.

func Tan added in v0.8.2

func Tan(x *py.Object) *py.Object

Return the tangent of x (measured in radians).

func Tanh added in v0.8.2

func Tanh(x *py.Object) *py.Object

Return the hyperbolic tangent of x.

func Trunc added in v0.8.2

func Trunc(x *py.Object) *py.Object

Truncates the Real x to the nearest Integral toward 0.

Uses the __trunc__ magic method.

func Ulp added in v0.8.2

func Ulp(x *py.Object) *py.Object

Return the value of the least significant bit of the float x.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL