From: Scott D. D. <Sco...@Ac...> - 2007-12-26 16:32:17
|
Bruce Sherwood wrote: > There is a highly technical problem which has been identified but for > which there is currently no known solution. In the old Numeric module > used in Visual 3, sqrt(5.5) was a float, but in numpy used in the beta > version sqrt(5.5) is numpy.float64, with the highly unfortunate result > that sqrt(5.5)*vector isn't a VPython vector but rather a numpy array. If you use the simple expedient of using math.sqrt, rather than numpy.sqrt, you will have the behavior you prefer. The "ufunc"s in numpy that have corresponding functions in math are: ceil cos cosh exp fabs floor fmod frexp hypot ldexp log log10 modf sin sinh sqrt tan tanh So adding: from math import (ceil, cos, cosh, exp, fabs, floor, fmod, frexp, hypot, ldexp, log, log10, modf, sin, sinh, sqrt, tan, tanh) after importing numpy (or the moral equivalent) will give you scalar- producing and consuming functions, as opposed to the numpy-internal floating format. -Scott David Daniels Sco...@Ac... |