4 ms·
Why does this use all the mathematical function from scipy instead of the built-in math? Are there significant benefits to that?
by jabberthemutt 8y ago
Why does this use all the mathematical function from scipy instead of the built-in math? Are there significant benefits to that?
- snops 8y agoThey are actually from numpy, scipy just re-exports them, so they work with numpy arrays which the built in maths would not. I guess the author writes a lot of scientific code, so is in the habit of using them. Numpy arrays are much faster than python lists etc for maths and matrix operations, (e.g. multiply this 1000 element vector by 2), which are common in scientific and engineering code. https://docs.scipy.org/doc/numpy-1.15.1/reference/generated/numpy.sin.html https://docs.scipy.org/doc/numpy-1.15.1/reference/generated/...
- johndcook 8y agoYes, the author does write a lot of scientific code and is in the habit of using SciPy. -- the author :)