Convenience and test functions
All the convenience functions are designed to facilitate a computational environment where the user does not need to worry about relative errors. The functions seem to be pointless at first sight, but behind their codes, there are state-of-the-art ideas that offer faster and more reliable results.
We have convenience functions beyond the ones defined in the NumPy libraries to find the solutions of trigonometric functions in degrees (cosdg
, sindg
, tandg
, and cotdg
); to compute angles in radians from their expressions in degrees, minutes, and seconds (radian
); common powers (exp2
for 2**x, and exp10
for 10**x); and common functions for small values of the variable (log1p
for log(1 + x), expm1
for exp(x) - 1, and cosm1
for cos(x) - 1).
For instance, in the following code snippet, the log1p
function computes the natural logarithm of 1 + x. Why not simply add 1 to the value of x and then take the logarithm instead? Let's compare:
>>> import numpy >>...