[SciPy-user] Radians vs. degrees

Fernando Perez Fernando.Perez at colorado.edu
Wed Oct 26 12:32:09 CDT 2005


Christian Meesters wrote:
> Thank you Ryan. Though an explicit conversion was not what I had in 
> mind. My equations got way too long now and this is the reason why I 
> would ask whether a simple mode change could be included into the new 
> scipy-core? Travis, what's your opinion? (And forgive me if this is 
> already included ;-) .)

why can't you just write a couple of top-level utilities like this

r2d = pi/180.0
dsin = lambda deg: sin(deg*r2d)
dcos = lambda deg: cos(deg*r2d)

and use explicitly dsin/dcos when you need the degree versions?

As far as _any_ mechanism to globally flip sin/cos/etc to defaulting silently 
to degrees, I'll be -1000 (and loudly) on that.  There are a million 
mathematical reasons why the core trig functions should remain, always, in 
their proper units (radians - which aren't really a unit, btw).

For something like this, 'explicit is better than implicit' is a good one to 
remember.

Cheers,

f



More information about the SciPy-user mailing list