acos() math function in python by R4R Team

- acos() is python math function which determine the arc cosine value of number in radians

Syntax-

math.acos(x)

- Here x should be a numeric value between -1 and 1.
- it return the arc of cosine of x in radians.

Example-

acos(1) will return 0.0
acos(0.5) will 1.0471975511965979

program-

import math

#these value are in radians
print("acos(1) : ",math.acos(1))
print("acos(0.34) : ",math.acos(0.34))
print("acos(0.5) : ",math.acos(0.5))
print("acos(-0.49) : ",math.acos(-0.49))
print("acos(0) : ",math.acos(0))


output-

acos(1) : 0.0
acos(0.34) : 1.2238794292677349
acos(0.5) : 1.0471975511965979
acos(-0.49) : 2.0828860797290445
acos(0) : 1.5707963267948966


-If we want to print the arc cosine value of x in degree then-

program-

import math

#these value are in degrees
n=180/math.pi
print("acos(1) : ",math.acos(1)*n)
print("acos(0.34) : ",math.acos(0.34)*n)
print("acos(0.5) : ",math.acos(0.5)*n)
print("acos(-0.49) : ",math.acos(-0.49)*n)
print("acos(0) : ",math.acos(0)*n)


output-

acos(1) : 0.0
acos(0.34) : 70.12312592992117
acos(0.5) : 60.00000000000001
acos(-0.49) : 119.34058157502375
acos(0) : 90.0




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!