[SciPy-User] Use of numpy functions instead builtins
Paul Anton Letnes
Sat Apr 3 09:57:31 CDT 2010
On 3. apr. 2010, at 03.02, Florian Lindner wrote:
> I've code that have a lot longer formulas like this on:
> tan_theta = ( 2 * (1/tan(sa))*(Ma**2*sin(sa)**2-1)) / ( 2+Ma**2 * (self.f_prop.kappa+1 - 2 * sin(sa)**2) )
> all variables are scalars so it works fine with the stuff I get from the math package. Since I"m using scipy anyway in my app I wonder if there is any advantage using the numpy math functions (sin, cos, ..., exp, power). Is there any advantage using them over the python bultins?
I'm guessing this is not usually a problem, but I've also come across bugs in the python cmath library, so I don't trust it anymore. I'm not sure how often it is a problem, but it's damn annoying if you keep debugging and it's the library functions that are wrong.
Oh, and yes, the corresponding numpy functions were right.
More information about the SciPy-User