Open In App

Different uses of cosine function in Julia – cospi() and cosc() Method

The cospi() is an inbuilt function in julia which is used to compute the value of which is more accurately than , where x is the large value.
Syntax: cospi(x) Parameters:
  • x: Specified large value.
Returns: It returns the value of which is more accurately than .
Example:
# Julia program to illustrate 
# the use of cospi() method
  
# Getting the value of cos(pi x)
println(cospi(55))
println(cospi(22.7))
println(cospi(3.17))
println(cospi(22 / 7))

                    
Output:
-1.0
-0.5877852522924714
-0.8607420270039438
-0.9009688679024193

cosc()

The cosc() is an inbuilt function in julia which is used to compute the value of which is the derivative of sinc(x).
Syntax: cosc(x) Parameters:
  • x: Specified value.
Returns: It returns the value of .
Example:
# Julia program to illustrate 
# the use of cosc() method
  
# Getting the value of cos(pi x)/x-sin(pi x)/(pi x ^ 2)
println(cosc(0))
println(cosc(1))
println(cosc(3.14))
println(cosc(22 / 7))

                    
Output:
0.0
-1.0
-0.27441551248588253
-0.2726897540491998

Article Tags :