/usr/lib/python3/dist-packages/bumps/pmath.py is in python3-bumps 0.7.6-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | """
Standard math functions for parameter expressions.
"""
from six.moves import reduce, builtins
import math
from .parameter import function
__all__ = [
'exp', 'log', 'log10', 'sqrt',
'sin', 'cos', 'tan', 'asin', 'acos', 'atan', 'atan2',
'sind', 'cosd', 'tand', 'asind', 'acosd', 'atand', 'atan2d',
'sinh', 'cosh', 'tanh',
'degrees', 'radians',
'sum', 'prod',
]
def _cosd(v):
"""Return the cosine of x (measured in in degrees)."""
return math.cos(math.radians(v))
def _sind(v):
"""Return the sine of x (measured in in degrees)."""
return math.sin(math.radians(v))
def _tand(v):
"""Return the tangent of x (measured in in degrees)."""
return math.tan(math.radians(v))
def _acosd(v):
"""Return the arc cosine (measured in in degrees) of x."""
return math.degrees(math.acos(v))
def _asind(v):
"""Return the arc sine (measured in in degrees) of x."""
return math.degrees(math.asin(v))
def _atand(v):
"""Return the arc tangent (measured in in degrees) of x."""
return math.degrees(math.atan(v))
def _atan2d(dy, dx):
"""Return the arc tangent (measured in in degrees) of y/x.
Unlike atan(y/x), the signs of both x and y are considered."""
return math.degrees(math.atan2(dy, dx))
def _prod(s):
"""Return the product of a sequence of numbers."""
return reduce(lambda x, y: x * y, s, 1)
exp = function(math.exp)
log = function(math.log)
log10 = function(math.log10)
sqrt = function(math.sqrt)
degrees = function(math.degrees)
radians = function(math.radians)
sin = function(math.sin)
cos = function(math.cos)
tan = function(math.tan)
asin = function(math.asin)
acos = function(math.acos)
atan = function(math.atan)
atan2 = function(math.atan2)
sind = function(_sind)
cosd = function(_cosd)
tand = function(_tand)
asind = function(_asind)
acosd = function(_acosd)
atand = function(_atand)
atan2d = function(_atan2d)
sinh = function(math.sinh)
cosh = function(math.cosh)
tanh = function(math.tanh)
sum = function(builtins.sum)
prod = function(_prod)
min = function(builtins.min)
max = function(builtins.max)
# Define pickler for numpy ufuncs
#import copy_reg
#def udump(f): return f.__name__
#def uload(name): return getattr(np, name)
#copy_reg.pickle(np.ufunc, udump, uload)
|