degrees and radians.

Tim Hammerquist tim at vegeta.ath.cx
Sat May 4 04:30:58 EDT 2002


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?

Sorry for the confusion between languages here. The rest is still valid,
though.

Tim Hammerquist
-- 
Playing strip poker with an exhibitionist
somehow takes the challenge out of it.
    -- Nick Smith, Metropolitan



More information about the Python-list mailing list