degrees and radians.
Jim Richardson
warlock at eskimo.com
Sat May 4 13:47:55 EDT 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sat, 04 May 2002 08:30:58 GMT,
Tim Hammerquist <tim at vegeta.ath.cx> wrote:
> Tim Hammerquist graced us by uttering:
>> Jim Richardson graced us by uttering:
>>> I am trying to get the math module to deal with degrees rather than
>>> radians. (that it deals with radians for the angular functions like
>>> sin() isn't mentioned in the docs, which was sort of an eyeopener :)
>>> I can't find any info on doing this. I can convert from-to degrees in
>>> the code calling the function, but that's a bit clunky. Any pointers
>>> to an FM to R? :)
>>
>> Radians are what trig is based on. Otherwise the formula for the area
>> of a circle would be 'A = 360r'; since when does a unit circle have an
>> area of 360 square units?
>>
>> OTOH, `man 3 sin` on my system documents the sin() function of the C
>> math library _is_ documented as taking radians. On a POSIX system,
>> this is usually what is called by Ruby's Math.sin() method.
>>
>> Can you just write an additional method like
>>
>> def sin_d(deg)
>> Math.sin(deg * Math::PI / 180)
>> end
>>
>> ...and maybe even make it a method of the Math module itself?
>
This is basically what I am now doing, (although yours is more elegant.)
I didn't realize that python basically called the C math function,
although that makes sense. I didn't think to check that. Thanks.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE81B7Ld90bcYOAWPYRAizKAKC4m5k2syn+c9xAA2M+mKmIQmZPpQCgrOzD
Lp6BYYh7ZLRLDPRmOe2pxDs=
=A8lE
-----END PGP SIGNATURE-----
--
Jim Richardson
Anarchist, pagan and proud of it
http://www.eskimo.com/~warlock
Linux, from watches to supercomputers, for grandmas and geeks.
More information about the Python-list
mailing list