python - Element-wise operations in mpmath -
i looking perform element-wise mpmath operations on python arrays. example,
import mpmath mpm x = mpm.arange(0,4) y = mpm.sin(x) # error alternatively, using mpmath matrices
x = mpm.matrix([0,1,2,3]) y = mpm.sin(x) # error does mpmath have capibilities in area, or necessary loop through entries?
mpmath not appear handle elemnt-wise operation, can use numpy functionality:
import numpy np import mpmath mpm x = np.array(mpm.arange(0,4)) sin = np.vectorize(mpm.sin) y = sin(x)
Comments
Post a Comment