Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: whats up with the sin stuff?

by repson (Chaplain)
on Apr 18, 2001 at 19:23 UTC ( #73532=note: print w/ replies, xml ) Need Help??


in reply to whats up with the sin stuff?

Quite simple, perl (and most other programming languages) take angles for trig functions in radians, while calculators take them in degrees, radians or gradians (usually). Most people prefer degrees, but radians are nicer to mathamaticians and other similar people.

The best thing for you to do is

use Math::Trig; $num = sin( deg2rad( 45 ) );
I think Math::Trig is part of the standard perl distribution, so read the documentation and go for it.

Update: I know about the math of radians as jepri explained but after the amount of it i've done at school recently I didn't feel like providing an explanation.


Comment on Re: whats up with the sin stuff?
Download Code
Re: Re: whats up with the sin stuff?
by jepri (Parson) on Apr 19, 2001 at 10:29 UTC
    Or you could just divide or multiply by pi/180 (depending on whether you are converting to or from).

    It helps to know that there are 2*pi radians in circle. So the math goes like this:

    (radiians)2*pi=360(degrees) pi=180 1 radiian=180/pi degrees turn it around 1 degree=pi/180 radiians

    I tend to work in radiians, since it's easier for a few things.

    ____________________
    Jeremy
    I didn't believe in evil until I dated it.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://73532]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (15)
As of 2014-07-29 16:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (222 votes), past polls