GXMATH class¶
-
class
geosoft.gxapi.
GXMATH
¶ This is not a class. This is a collection of standard mathematical functions, including most of the common logarithmic and geometric functions.
-
static
abs_double
((float)arg1) → float:¶ Calculate absolute value
Parameters: arg1 (float) – real Returns: real Return type: float New in version 6.0.1.
Note:
Dummy values return dummy
-
static
abs_int
((int)arg1) → int:¶ Calculate absolute value
Parameters: arg1 (int) – integer Returns: integer Return type: int New in version 6.0.1.
Note:
Dummy values return dummy
-
static
and
((int)arg1, (int)arg2) → int:¶ Return the unary operation result of A & B Returns an integer number If A or B is a dummy, returns dummy.
Parameters: - arg1 (int) – A
- arg2 (int) – B
Return type: int
New in version 6.3.0.
-
static
arc_cos
((float)arg1) → float:¶ Calculate the arccosine
Parameters: arg1 (float) – real Returns: real Return type: float New in version 6.0.1.
Note:
Dummy values or values < -1 or > 1 return dummy
-
static
arc_sin
((float)arg1) → float:¶ Calculate the arcsin
Parameters: arg1 (float) – real Returns: real Return type: float New in version 6.0.1.
Note:
Dummy values or values < -1 or > 1 return dummy
-
static
arc_tan
((float)arg1) → float:¶ Calculate the arctan
Parameters: arg1 (float) – real Returns: real Return type: float New in version 6.0.1.
Note:
Dummy values return dummy
-
static
arc_tan2
((float)arg1, (float)arg2) → float:¶ Calculate ArcTan(Y/X)
Parameters: - arg1 (float) – Y
- arg2 (float) – X
Returns: real
Return type: float
New in version 6.0.1.
Note:
If either X or Y is a dummy, returns dummy
-
static
ceil
((float)arg1) → float:¶ Calculates the ceiling of the value
Parameters: arg1 (float) – real Returns: real Return type: float New in version 6.0.1.
Note:
Dummy values return dummy
-
static
cos
((float)arg1) → float:¶ Calculate the cosine
Parameters: arg1 (float) – Angle in radians Returns: real Return type: float New in version 6.0.1.
Note:
Dummy values return dummy
-
static
cross_product
((float)arg1, (float)arg2, (float)arg3, (float)arg4, (float)arg5, (float)arg6, (float_ref)arg7, (float_ref)arg8, (float_ref)arg9) → None:¶ Cross product of two vectors.
Parameters: - arg1 (float) – X1 component
- arg2 (float) – Y1 component
- arg3 (float) – Z1 component
- arg4 (float) – X2 component
- arg5 (float) – Y2 component
- arg6 (float) – Z2 component
- arg7 (
geosoft.gxapi.float_ref
) – X3 component (output) - arg8 (
geosoft.gxapi.float_ref
) – Y3 component (output) - arg9 (
geosoft.gxapi.float_ref
) – Z3 component (output)
Returns: Nothing
Return type: None
New in version 6.0.0.
-
static
dot_product_3d
((float)arg1, (float)arg2, (float)arg3, (float)arg4, (float)arg5, (float)arg6) → float:¶ Compute Dot product of two vectors.
Parameters: - arg1 (float) – X1 component
- arg2 (float) – Y1 component
- arg3 (float) – Z1 component
- arg4 (float) – X2 component
- arg5 (float) – Y2 component
- arg6 (float) – Z2 component
Returns: Dot product
Return type: float
New in version 6.0.0.
-
static
exp
((float)arg1) → float:¶ Calculate e raised to the power of X
Parameters: arg1 (float) – X Returns: real Return type: float New in version 6.0.1.
Note:
Dummy values return dummy
-
static
floor
((float)arg1) → float:¶ Calculates the floor of the value
Parameters: arg1 (float) – real Returns: real Return type: float New in version 6.0.1.
Note:
Dummy values return dummy
-
static
hypot
((float)arg1, (float)arg2) → float:¶ sqrt(X*X + Y*Y)
Parameters: - arg1 (float) – X
- arg2 (float) – Y
Returns: real
Return type: float
New in version 6.0.1.
Note:
If either X or Y is a dummy, the returned value is dummy
-
static
lambda_trans
((float)arg1, (float)arg2) → float:¶ Performs lambda transform on a value.
Parameters: - arg1 (float) – Z Value
- arg2 (float) – Lambda value
Returns: The lambda transformed value
Return type: float
New in version 6.0.1.
Note:
Returns 0 for input Z = 0. returns log10(Z) for lambda = 0. returns (Z^lambda - 1)/lambda for Z > 0. returns dummy for Z = dummy.
-
static
lambda_trans_rev
((float)arg1, (float)arg2) → float:¶ Performs a reverse lambda transform on a value.
Parameters: - arg1 (float) – Lambda transformed Z Value
- arg2 (float) – Lambda value
Returns: The original non-lambda transformed value
Return type: float
New in version 6.0.1.
Note:
See rLambdaTrans.
See also
-
static
log
((float)arg1) → float:¶ Calculate the natural log
Parameters: arg1 (float) – real Returns: real Return type: float New in version 6.0.1.
Note:
Dummy values return dummy
-
static
log10
((float)arg1) → float:¶ Calculate the base 10 log
Parameters: arg1 (float) – real Returns: real Return type: float New in version 6.0.1.
Note:
Dummy values return dummy
-
static
log_z
((float)arg1, (int)arg2, (float)arg3) → float:¶ Given a Z value and the Log style and Log Minimum this function will return the log value.
Parameters: - arg1 (float) – Z Value
- arg2 (int) – Log Mode (0 - Log, 1 - LogLinearLog)
- arg3 (float) – Log Minimum (must be greater than 0)
Returns: The Log Value.
Return type: float
New in version 6.0.1.
Note:
Mode = 0 (regular log mode) Returns: Log10(Z) for Z > minimum Log10(minimum) for Z <= minimum Mode = 1 (log / linear / negative log mode) Returns: minimum * ( log10( |Z| / minimum) + 1 ) for Z > minimum Z for |Z| <= minimum (the linear part of the range) -minimum * ( log10( |Z| / minimum) + 1 ) for Z < -minimum
See also
-
static
mod_double
((float)arg1, (float)arg2) → float:¶ Calculates the modulus of two reals (A mod B)
Parameters: - arg1 (float) – A
- arg2 (float) – B (must not be zero)
Returns: real
Return type: float
New in version 6.0.1.
Note:
The modulus of A with respect to B is defined as the difference of A with the largest integral multiple of B smaller than or equal to A. e.g. A mod B 20 mod 10 = 0 20 mod 9 = 2 f A or B is a dummy, returns dummy.
-
static
mod_int
((int)arg1, (int)arg2) → int:¶ Calculates the modulus of two integers
Parameters: - arg1 (int) – A
- arg2 (int) – B (must not be zero)
Returns: int
Return type: int
New in version 6.0.1.
Note:
If A or B is a dummy, returns dummy.
-
static
nicer_log_scale
((float_ref)arg1, (float_ref)arg2, (int)arg3) → None:¶ Finds nicer min, max values for logarithmic plot scales.
Parameters: - arg1 (
geosoft.gxapi.float_ref
) – Min value (changed) - arg2 (
geosoft.gxapi.float_ref
) – Max value (changed) - arg3 (int) – Fine flag
Returns: Nothing
Return type: None
New in version 6.0.1.
Note:
Will fail if the input upper bound is less than the lower bound, but will work if the two values are equal. The input bounds are overwritten. Input lower and upper bounds, returns "nicer" values. If the Fine flag is set to TRUE, the values will have the form N x 10^Y, where N is a value from 1 to 9, and 10^Y is an integral power of 10. If the Fine flag is set to FALSE, the scaling is coarse, and the bounding exact powers of 10 are returned. For example, the values (.034, 23) return (.03, 30) for fine scaling, and (0.01, 100) for coarse scaling.
- arg1 (
-
static
nicer_scale
((float_ref)arg1, (float_ref)arg2, (float_ref)arg3, (int_ref)arg4) → None:¶ Compute a nicer scale for a given min and max.
Parameters: - arg1 (
geosoft.gxapi.float_ref
) – Min value (changed) - arg2 (
geosoft.gxapi.float_ref
) – Max value (changed) - arg3 (
geosoft.gxapi.float_ref
) – Inc value (returned) - arg4 (
geosoft.gxapi.int_ref
) – Power value (returned)
Returns: Nothing
Return type: None
New in version 6.0.1.
- arg1 (
-
static
normalise_3d
((float_ref)arg1, (float_ref)arg2, (float_ref)arg3) → None:¶ Scale a vector to unit length.
Parameters: - arg1 (
geosoft.gxapi.float_ref
) – X component (altered) - arg2 (
geosoft.gxapi.float_ref
) – Y component (altered) - arg3 (
geosoft.gxapi.float_ref
) – Z component (altered)
Returns: Nothing
Return type: None
New in version 6.0.0.
Note:
Divides each component by the vector magnitude.
- arg1 (
-
static
or
((int)arg1, (int)arg2) → int:¶ Return the unary operation result of A | B Returns an integer number If A or B is a dummy, returns dummy.
Parameters: - arg1 (int) – A
- arg2 (int) – B
Return type: int
New in version 6.3.0.
-
static
pow
((float)arg1, (float)arg2) → float:¶ Calculate X raised to the power of Y
Parameters: - arg1 (float) – X
- arg2 (float) – Y
Returns: real
Return type: float
New in version 6.0.1.
Note:
If either X or Y is a dummy, returns dummy
-
static
rand
() → float:¶ Get a random number between 0 and 1
Returns: a real number Return type: float New in version 6.3.0.
Note:
Use
geosoft.gxapi.GXMATH.s_rand()
to seed the random number generator before a series of calls to this function are made. The standard "C" function rand() is called.
-
static
rotate_vector
((float)arg1, (float)arg2, (float)arg3, (float)arg4, (float)arg5, (float)arg6, (float)arg7, (float_ref)arg8, (float_ref)arg9, (float_ref)arg10) → None:¶ Rotate a vector about an axis.
Parameters: - arg1 (float) – X1 component (vector to rotate)
- arg2 (float) – Y1 component
- arg3 (float) – Z1 component
- arg4 (float) – Angle to rotate, CW in radians
- arg5 (float) – X2 component (axis of rotation)
- arg6 (float) – Y2 component
- arg7 (float) – Z2 component
- arg8 (
geosoft.gxapi.float_ref
) – X3 component (rotated vector, can - arg9 (
geosoft.gxapi.float_ref
) – Y3 component be the same as input) - arg10 (
geosoft.gxapi.float_ref
) – Z3 component
Returns: Nothing
Return type: None
New in version 6.0.0.
Note:
Rotates a vector by the input angle around an arbitrary axis. Angles are measured clockwise looking along the axis (away from the origin). Assumes a right hand coordinate system.
-
static
round_double
((float)arg1, (int)arg2) → float:¶ Round to n significant digits
Parameters: - arg1 (float) – real
- arg2 (int) – number of significant digits to round to
Returns: real
Return type: float
New in version 6.0.1.
Note:
Negative values ending in 5XXX to n sig digits round down Positive values ending in 5XXX to n sig digits round up Dummy values return dummy
-
static
round_int
((float)arg1) → int:¶ Round to the nearest whole number
Parameters: arg1 (float) – round Returns: integer Return type: int New in version 6.0.1.
Note:
Negative values with decimal parts larger than .5 round down (-1.5 -> 2.0) Positive values with decimal parts larger than .5 round up (1.5 -> 2.0) Dummy values return dummy
-
static
s_rand
() → None:¶ Seed the random-number generator with current time
Returns: Nothing Return type: None New in version 6.3.0.
Note:
Use the
geosoft.gxapi.GXMATH.rand()
function to create a random number between 0 and 1. The standard "C" function srand() is called.
-
static
sign
((float)arg1, (float)arg2) → float:¶ Determine return value based on value of Z1
Parameters: - arg1 (float) – Z1
- arg2 (float) – Z2
Returns: |Z2| if Z1>0, -|Z2| if Z1<0, 0 if Z1 = 0, and Z2 if Z1 = Dummy
Return type: float
New in version 6.0.1.
Note:
Dummy values return dummy
-
static
sin
((float)arg1) → float:¶ Calculate the sin
Parameters: arg1 (float) – Angle in radians Returns: real Return type: float New in version 6.0.1.
Note:
Dummy values return dummy
-
static
sqrt
((float)arg1) → float:¶ Calculate the square root
Parameters: arg1 (float) – real Returns: real Return type: float New in version 6.0.1.
Note:
Dummy values return dummy
-
static
tan
((float)arg1) → float:¶ Calculate the tangent
Parameters: arg1 (float) – Angle in radians Returns: real Return type: float New in version 6.0.1.
Note:
Dummy values return dummy
-
static
un_log_z
((float)arg1, (int)arg2, (float)arg3) → float:¶ Inverse of rLogZ
Parameters: - arg1 (float) – log value
- arg2 (int) – Log Mode (0 - Log, 1 - LogLinearLog)
- arg3 (float) – Log Minimum (must be greater than 0)
Returns: The original value
Return type: float
New in version 6.0.1.
Note:
See Notes for rLogZ.
See also
-
static
xor
((int)arg1, (int)arg2) → int:¶ Return the unary operation result of A ^ B Returns an integer number If A or B is a dummy, returns dummy.
Parameters: - arg1 (int) – A
- arg2 (int) – B
Return type: int
New in version 6.3.0.
-
static