BasicFunctions Type

Basic functions.

Constructors

Constructor Description

BasicFunctions()

Full Usage: BasicFunctions()

Static members

Static member Description

BasicFunctions.CopySign(x, y)

Full Usage: BasicFunctions.CopySign(x, y)

Parameters:
    x : float - The first number.
    y : float - The second number whose sign is used.

Returns: float The first number x with the sign of the second argument y.

Return first number with the sign of second number

x : float

The first number.

y : float

The second number whose sign is used.

Returns: float

The first number x with the sign of the second argument y.

BasicFunctions.LogRel(x)

Full Usage: BasicFunctions.LogRel(x)

Parameters:
    x : float - The function argument.

Returns: float

LogRel(z) = log(1+z) with relative error accuracy near z = 0.

             June 1977 edition.   W. Fullerton, c3, Los Alamos Scientific Lab.
            
             series for alnr       on the interval -3.75000e-01 to  3.75000e-01
                                                    with weighted error   6.35e-32
                                                     log weighted error  31.20
                                           significant figures required  30.93
                                                decimal places required  32.01

x : float

The function argument.

Returns: float

BasicFunctions.LogRel(x, bDebug)

Full Usage: BasicFunctions.LogRel(x, bDebug)

Parameters:
    x : float - The function argument.
    bDebug : bool - If true, an exception will be thrown if errors occur, if false, double.NaN is returned in this case.

Returns: float

LogRel(z) = log(1+z) with relative error accuracy near z = 0.

             June 1977 edition.   W. Fullerton, c3, Los Alamos Scientific Lab.
            
             series for alnr       on the interval -3.75000e-01 to  3.75000e-01
                                                    with weighted error   6.35e-32
                                                     log weighted error  31.20
                                           significant figures required  30.93
                                                decimal places required  32.01

x : float

The function argument.

bDebug : bool

If true, an exception will be thrown if errors occur, if false, double.NaN is returned in this case.

Returns: float

BasicFunctions.LogRel(z)

Full Usage: BasicFunctions.LogRel(z)

Parameters:
    z : Complex - The complex argument z.

Returns: Complex Log(1+z) with relative error accuracy near z=0.

LogRel(z) = log(1+z) with relative error accuracy near z = 0.

             April 1977 version.  W. Fullerton, c3, Los Alamos Scientific Lab.
            
             let   rho = abs(z)  and
                   r**2 = abs(1+z)**2 = (1+x)**2 + y**2 = 1 + 2*x + rho**2 .
             now if rho is small we may evaluate LogRel(z) accurately by
                   log(1+z) = complex (log(r), arg(1+z))
                            = complex (0.5*log(r**2), arg(1+z))
                            = complex (0.5*LogRel(2*x+rho**2), arg(1+z))

z : Complex

The complex argument z.

Returns: Complex

Log(1+z) with relative error accuracy near z=0.

BasicFunctions.LogRel(z, bDebug)

Full Usage: BasicFunctions.LogRel(z, bDebug)

Parameters:
    z : Complex - The complex argument z.
    bDebug : bool - If true, an exception will be thrown if errors occur, if false, double.NaN is returned in this case.

Returns: Complex Log(1+z) with relative error accuracy near z=0.

LogRel(z) = log(1+z) with relative error accuracy near z = 0.

             April 1977 version.  W. Fullerton, c3, Los Alamos Scientific Lab.
            
             let   rho = abs(z)  and
                   r**2 = abs(1+z)**2 = (1+x)**2 + y**2 = 1 + 2*x + rho**2 .
             now if rho is small we may evaluate LogRel(z) accurately by
                   log(1+z) = complex (log(r), arg(1+z))
                            = complex (0.5*log(r**2), arg(1+z))
                            = complex (0.5*LogRel(2*x+rho**2), arg(1+z))

z : Complex

The complex argument z.

bDebug : bool

If true, an exception will be thrown if errors occur, if false, double.NaN is returned in this case.

Returns: Complex

Log(1+z) with relative error accuracy near z=0.

BasicFunctions.Nint(d)

Full Usage: BasicFunctions.Nint(d)

Parameters:
    d : float - The argument.

Returns: int The nearest integer of the argument d.

Round to nearest integer.

d : float

The argument.

Returns: int

The nearest integer of the argument d.

BasicFunctions.NumberOfWraps(len, start, offset)

Full Usage: BasicFunctions.NumberOfWraps(len, start, offset)

Parameters:
    len : int - Length of the range.
    start : int - Start point.
    offset : int - Offset.

Returns: int Number of range wraps when going from start to start+offset. In case offset is negative, the function returns a negative value.

Calculates the number of wraps w. This is the number of range wraps that must be taken to go from start to start+offset.

len : int

Length of the range.

start : int

Start point.

offset : int

Offset.

Returns: int

Number of range wraps when going from start to start+offset. In case offset is negative, the function returns a negative value.

BasicFunctions.PMod(x, y)

Full Usage: BasicFunctions.PMod(x, y)

Parameters:
    x : int - Nominator.
    y : int - Denominator.

Returns: int The remainder of the division x by y, but guaranted to be in the positive range.

Modulus x%y, but with result guaranted to be greater or equal to zero.

x : int

Nominator.

y : int

Denominator.

Returns: int

The remainder of the division x by y, but guaranted to be in the positive range.

BasicFunctions.hypot (x, y, z)

Full Usage: BasicFunctions.hypot (x, y, z)

Parameters:
    x : float32 - First argument.
    y : float32 - Second argument.
    z : float32 - Third argument.

Returns: float32 Square root of the sum of x-square, y-square and z-square.

The standard hypot() function for three arguments taking care of overflows and zerodivides.

x : float32

First argument.

y : float32

Second argument.

z : float32

Third argument.

Returns: float32

Square root of the sum of x-square, y-square and z-square.

BasicFunctions.hypot (x, y, z)

Full Usage: BasicFunctions.hypot (x, y, z)

Parameters:
    x : float - First argument.
    y : float - Second argument.
    z : float - Third argument.

Returns: float Square root of the sum of x-square, y-square and z-square.

The standard hypot() function for three arguments taking care of overflows and zerodivides.

x : float

First argument.

y : float

Second argument.

z : float

Third argument.

Returns: float

Square root of the sum of x-square, y-square and z-square.

BasicFunctions.sign x

Full Usage: BasicFunctions.sign x

Parameters:
    x : float - The number whose sign is returned.

Returns: int -1 if the argument is negative, 0 if the argument is zero, or 1 if argument is positive.

Returns -1 if argument negative, 0 if argument zero, or 1 if argument is positive.

x : float

The number whose sign is returned.

Returns: int

-1 if the argument is negative, 0 if the argument is zero, or 1 if argument is positive.