CurveExpert Basic 2.2.3 documentation

This section documents the math functions that are available for use in CurveExpert Basic custom models, functions, and data transformations.

All functions below, unless otherwise stated, work on either scalars (a single number) or an array (a vector). If an array is passed to any of these functions, the function is applied elementwise to each member of the array.

Trigonometric inverse cosine. The inverse of cos so that, if `y = cos(x)`

, then `x = acos(y)`

.
The domain is [-1, 1].

acos is a multivalued function: for each x there are infinitely many numbers z such that cos(z) = x. The convention is to return the angle z whose real part lies in [0, pi].

The inverse cos is also known as arccos or cos^-1.

Inverse hyperbolic cosine.

acosh is a multivalued function: for each x there are infinitely
many numbers z such that cosh(z) = x. The convention is to return the
z whose imaginary part lies in [-pi, pi] and the real part in
`[0, inf]`

.

Inverse sine. The inverse sine of each element in x, in radians and in the
closed interval `[-pi/2, pi/2]`

.

arcsin is a multivalued function: for each x there are infinitely many numbers z such that . The convention is to return the angle z whose real part lies in [-pi/2, pi/2].

The inverse sine is also known as arcsin or sin^{-1}.

Inverse hyperbolic sine.

arcsinh is a multivalued function: for each x there are infinitely many numbers z such that sinh(z) = x. The convention is to return the z whose imaginary part lies in [-pi/2, pi/2].

The inverse hyperbolic sine is also known as arcsinh or `sinh^-1`

.

Trigonometric inverse tangent. The inverse of tan, so that if `y = tan(x)`

then `x = atan(y)`

.

atan is a multi-valued function: for each x there are infinitely many numbers z such that tan(z) = x. The convention is to return the angle z whose real part lies in [-pi/2, pi/2].

The inverse tangent is also known as arctan or tan^{-1}.

Arc tangent of `y/x`

choosing the quadrant correctly.

The quadrant (i.e., branch) is chosen so that `arctan2(y, x)`

is
the signed angle in radians between the ray ending at the origin and
passing through the point (1,0), and the ray ending at the origin and
passing through the point (x2, x1). By IEEE convention, this function is defined for
x = +/-0 and for either or both of y and x = +/-inf (see
Notes for specific values).

Returns angle in radians, in the range `[-pi, pi]`

.

Inverse hyperbolic tangent.

arctanh is a multivalued function: for each x there are infinitely many numbers z such that tanh(z) = x. The convention is to return the z whose imaginary part lies in [-pi/2, pi/2].

The inverse hyperbolic tangent is also known as arctanh or `tanh^-1`

.

Trigonometric cosine.

Hyperbolic cosine. Equivalent to `1/2 * (exp(x) + exp(-x))`

.

Calculate the exponential.

The irrational number `e`

is also known as Euler’s number. It is
approximately 2.718281, and is the base of the natural logarithm,
`ln`

(this means that, if ,
then . For real input, `exp(x)`

is always positive.

Natural logarithm (synonym for log). The natural logarithm ln is the inverse of the exponential function, so that ln(exp(x)) = x. The natural logarithm is logarithm in base e.

Natural logarithm. The natural logarithm log is the inverse of the exponential function, so that log(exp(x)) = x. The natural logarithm is logarithm in base e.

Return the base 10 logarithm. NaNs is returned if x is negative.

Trigonometric sine.

Hyperbolic sine, element-wise. Equivalent to `1/2 * (exp(x) - exp(-x))`

.

Return the positive square-root. Returns NaN if x is negative.

Compute tangent. Equivalent to `sin(x)/cos(x)`

.

Compute hyperbolic tangent. Equivalent to `sinh(x)/cosh(x)`

.

The Bessel function of order 0 at x.

The Bessel function of order 1 at x.

Bessel function of integer or real order n.

The Bessel function of the second kind of order 0 at x.

The Bessel function of the second kind of order 1 at x.

Bessel function of the second kind of integer or real order n at x.

Modified Bessel function of the first kind, order 0.

Modified Bessel function of order 1 at x.

Modified Bessel function of the second kind (sometimes called the third kind) of order 0 at x.

Modified Bessel function of the second kind (sometimes called the third kind) of order 1 at x.

Modified Bessel function of the second kind (sometimes called the third kind) for integer or real order n at x.

Exponentially scaled modified Bessel function of order 0 at x. bessel_i0e(x) = exp(-|x|) * bessel_i0(x).

Exponentially scaled modified Bessel function of order 0 at x. bessel_i1e(x) = exp(-|x|) * bessel_i1(x).

Exponentially scaled modified Bessel function of the second kind (sometimes called the third kind) of order 0 at x. bessel_k0e(x) = exp(x) * bessel_k0(x).

Exponentially scaled modified Bessel function of the second kind (sometimes called the third kind) of order 1 at x. bessel_k1e(x) = exp(x) * bessel_k1(x).

Return the ith derivative of bessel_jn(n,x).

Return the nth derivative of bessel_yn(n,x).

Return the nth derivative of bessel_kn(n,x).

Return the nth derivative of bessel_in(n,x).

Element-wise maximum of array elements; compares two arrays and returns a new array containing the elementwise maxima. If one of the elements is a NaN, that element is returned.

Element-wise minimum of array elements; compares two arrays and returns a new array containing the elementwise minima. If one of the elements is a NaN, that element is returned.

Return the maximum of an array (returns a scalar). Optionally, the keyword ‘axis’ can be given to specify, for a 2D dataset, if the max should be taken down the columns (axis=0) or across the rows(axis=1).

Return the minimum of an array (returns a scalar). Optionally, the keyword ‘axis’ can be given to specify, for a 2D dataset, if the min should be taken down the columns (axis=0) or across the rows(axis=1).

Calculate the absolute value.

Returns the ceiling of the input. The ceil of the scalar x is the smallest integer i, such that i >= x.

Change the sign of x1 to that of x2.

Convert angles from radians to degrees.

Take the factorial of an integer n.

Return the floor of the input. The floor of the scalar x is the largest integer i, such that i <= x.

Some spreadsheet programs calculate the “floor-towards-zero”, in other
words `floor(-2.5) == -2`

. Here, however, we use the a definition of
floor such that floor(-2.5) == -3.

Return the remainder of division. Returns the remainder of the division of x1 by x2.

The result of the modulo operation for negative dividend and divisors is bound by conventions. In fmod, the sign of the remainder is the sign of the dividend. In remainder, the sign of the divisor does not affect the sign of the result.

Given the “legs” of a right triangle, return its hypotenuse. Equivalent to `sqrt(x1**2 + x2**2)`

.

Test for positive or negative infinity.

Test for Not a Number (NaN).

Legendre function of order n evaluated at x. Orthogonal over [1,1] with weighting function 1.

Solve a least squares problem, where A is a rectangular matrix. Returns a tuple of four quantities: x (the least squares solution), residuals (array ncol long), rank (integer indicating the effective rank of A), and s (the singular values of a). Common usage is as follows:

```
(soln,resid,rank,s) = solve_lstsq(A,B)
```

Can throw an exception if the computation is too ill-conditioned.

Shifted Legendre function of order n evaluated at x. Orthogonal over [0,1] with weighting function 1.

Convert angles from degrees to radians.

Round an array to a given number of decimals. number_of_decimals is an integer denoting the number of decimal places to retain.

Gamma function. The gamma function is often referred to as the generalized factorial since x*gamma(x) = gamma(x+1) and gamma(n+1) = n! for natural number n.

Note that the domain is limited to [1.0e-6,10].

Return the truncated value of the input. The truncated value of the scalar x is the nearest integer i which is closer to zero than x is. In short, the fractional part of the signed number x is discarded.

Append values to the end of an array.

Create an array from an array_like object, like a Python list or another array.

Convert the input to an array. a is an array_like object, like a Python list.

Return evenly spaced values within a given interval.

Values are generated within the half-open interval `[start, stop)`

(in other words, the interval including start but excluding stop).

Compute the arithmetic average (identical to the mean) of an array (returns a scalar). Optionally, the keyword ‘axis’ can be given to specify, for a 2D dataset, if the average should be taken down the columns (axis=0) or across the rows(axis=1).

Stack 1D arrays as columns into a 2D array.

Return an array copy of the given object.

Join a sequence of arrays together.

Dot product of two arrays a and b (returns a scalar)

Return a new array of given shape, without initializing entries. If the new array should be one dimensional, just an integer will suffice for the shape. If the new array should be multidimensional, then my_array = empty((n,3)) is an appropriate example.

Return a 2-D array with ones on the diagonal and zeros elsewhere.

Flip (reverse) an array in the left/right direction (columnwise).

Flip (reverse) an array in the up/down direction (rowwise).

Stack arrays in sequence horizontally (columnwise)

Return the identity array. The identity array is a square array with ones on the main diagonal.

Return evenly spaced numbers over a specified interval.

Returns n evenly spaced samples, calculated over the interval [start, stop ].

Compute the arithmetic mean (identical to the average) of an array (returns a scalar). Optionally, the keyword ‘axis’ can be given to specify, for a 2D dataset, if the mean should be taken down the columns (axis=0) or across the rows(axis=1).

Compute the median of an array along the specified column. Returns the median of the array elements. Optionally, the keyword ‘axis’ can be given to specify, for a 2D dataset, if the median should be taken down the columns (axis=0) or across the rows(axis=1).

Given a vector V of length N, the median of V is the middle value of
a sorted copy of V, `V_sorted`

- i.e., `V_sorted[(N-1)/2]`

, when N is
odd. When N is even, it is the average of the two middle values of
`V_sorted`

.

Returns as an integer array, the indices of the elements are are nonzero. This can be used for indexing into another array.

Return a new array of given shape, filled with ones. For example, my_array = ones(n) If the new array should be one dimensional, just an integer will suffice for the shape. If the new array should be multidimensional, then my_array = ones((n,3)) is an appropriate example.

Returns an array of ones with the same dimension as the given array.

Roll array elements rowwise; rows that roll beyond the last position are reintroduced at the first.

Returns an array of the given dimension (nrow x ncol) and fill it with random samples from a uniform distribution over [0,1).

Return an ascending sorted copy of the array.

Return the standard deviation of an array. Optionally, the keyword ‘axis’ can be given to specify, for a 2D dataset, if the standard deviation should be taken down the columns (axis=0) or across the rows(axis=1). Also optionally, the keyword ‘ddof’ can be given to determine the divisor used in the calculations. By default, ddof is 1.

Find the unique elements of an array; returns the sorted unique elements of an array. Works on only 1D arrays; the array will be flattened if it is not already 1D.

Return the variance of the array. Optionally, the keyword ‘axis’ can be given to specify, for a 2D dataset, if the variance should be taken down the columns (axis=0) or across the rows(axis=1).

Stack arrays in sequence vertically (rowwise).

Return a new array of given shape, filled with zeros. For example, my_array = zeros(n). If the new array should be one dimensional, just an integer will suffice for the shape. If the new array should be multidimensional, then my_array = zeros((n,3)) is an appropriate example.

Return an array of zeros with the same dimension as a given array. For example, my_array = zeros_like(x)

Applies the logical and operator, elementwise, to two boolean arrays b1 and b2. Returns another boolean array.

Applies the logical or operator, elementwise, to two boolean arrays b1 and b2. Returns another boolean array.

Applies the logical xor operator, elementwise, to two boolean arrays b1 and b2. Returns another boolean array.

Applies the logical not operator, elementwise, to a boolean array b1. Returns another boolean array.

Returns a boolean array that tests x1 > x2 elementwise.

Returns a boolean array that tests x1 < x2 elementwise.

Returns a boolean array that tests x1 <= x2 elementwise.

Returns a boolean array that tests x1 >= x2 elementwise.

Returns a boolean array that tests x1 == x2 elementwise.

Returns a boolean array that tests x1 != x2 elementwise.

Tests two arrays x1 and x2, elementwise, to see if they are nearly equal within the tolerances specified in rtol and atol. Returns a boolean array. rtol is a relative tolerance, and atol is an absolute tolerance. To determine closeness, the relative difference rtol*abs(b) and the absolute difference atol are added together to compare against the absolute difference between the elements of a and b.