Pi is a built-in R constant whose value is 3.141593. Pi is the ratio of the circumference of a circle to its diameter.
pi
print(pi)
Output
[1] 3.141593
To calculate the exponential value of pi, use the exp() function.
exp(pi)
Output
[1] 23.14069
To calculate the cosine value of pi, use the cos() function.
cos(pi)
Output
[1] -1
To find the sine value of pi, use the sin() function.
sin(pi)
Output
[1] 1.224647e-16
To calculate the tangent of pi, use the tan() function and pass the pi.
tan(pi)
Output
[1] -1.224647e-16
To calculate the arccos value of pi, use the acos() and pass the pi.
acos(pi)
Output
[1] NaN
Warning message:
In acos(pi) : NaNs produced
It returns the NaN value.
To calculate the arccos value, use the asin() function.
asin(pi)
Output
[1] NaN
Warning message:
In asin(pi) : NaNs produced
It returns NaN too.
To calculate the arccos value, use the atan() function.
atan(pi)
Output
[1] 1.262627
That’s it!
Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.
The group_by() function from the dplyr package allows us to group data frames by one…
The dplyr::slice() function subsets rows by their position or index within a data frame. If…
R vectors are atomic, which means they have homogeneous data types. They are contiguous in…
DataFrames are like tables that contain rows and columns. Each column can have a different…
Dates in R are stored as the number of days since 1970-01-01, so converting a…
In R, you can think of a vector as a series of values in a…