Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Radian measure in sin in R?

Tags:

r

trigonometry

I want to calculate the following in R:

sin(52.517°)

and this should be equal to 0.79353. But when I code

sin(52.517)

I get

0.777119

So how can I get the 0.79353. I am not good in math, but I know something is not working with degrees and the radian measure here in R.

like image 536
Jen Bohold Avatar asked Jan 28 '14 09:01

Jen Bohold


People also ask

What is sin of angle R?

What is sin() in R? The sin() function in R returns the sine of a number in radians. The illustration below shows the mathematical representation of the sin() function. This sin() function only works for right-angled triangles.

Does R use radians or degrees?

sin in the R console: Angles are in radians, not degrees (i.e., a right angle is π/2). So by default, the trigonometric functions take radians as input and not degrees.

Why does sin take radians instead of degrees in R?

From the help page on sin which you can read by typing in ?sin in the R console: Angles are in radians, not degrees (i.e., a right angle is π/2). So by default, the trigonometric functions take radians as input and not degrees.

How do you find the measure of a radian?

Imagine a circle and a central angle in it. If the length of an arc that this angle cuts off the circle equals to its radius, then, by definition, this angle's measure is 1 radian. If an angle is twice as big, the arc it cuts off the circle will be twice as long and the measure of this angle will be 2 radians.

What do you need to know about radians in math?

In case of radians, one should understand the concept of circles and related terms along with their meaning and formulas. In this article, what is the radian measure of an angle, how to find the measure of an angle in radians and measurement of different angles in radians are explained.

What is the value of 2 radians in degrees?

Thus 2 π radians is equal to 360 degrees, meaning that one radian is equal to 180/ π ≈ 57.29577 95130 82320 876 degrees. , and by using a circle of radius 1. Since radian is the measure of an angle that subtends an arc of a length equal to the radius of the circle, . This can be further simplified to .


2 Answers

From the help page on sin which you can read by typing in ?sin in the R console:

Angles are in radians, not degrees (i.e., a right angle is π/2).

So by default, the trigonometric functions take radians as input and not degrees. To get the sin(52.517) you need to convert those degrees to a radian measure first:

52.517 degrees = 52.517 * (pi/180) = sin(52.517*(pi/180)) = 0.916...

If you do:

sin(52.517*(pi/180))

you get the wanted 0.7935339.

like image 135
Martin Dinov Avatar answered Oct 15 '22 06:10

Martin Dinov


it works

1 degree =0.0174532925 radians
sin(52.517*0.0174532925)
[1] 0.7935339

EDIT

refered from here

 degrees.to.radians<-function(degrees=45,minutes=30)
{
if(!is.numeric(minutes)) stop("Please enter a numeric value for minutes!\n")
if(!is.numeric(degrees)) stop("Please enter a numeric value for degrees!\n")
decimal<-minutes/60
c.num<-degrees+decimal
radians<-c.num*pi/180
radians
}
sin(degrees.to.radians(52.517,0))
[1] 0.7935339
like image 38
Aashu Avatar answered Oct 15 '22 07:10

Aashu