A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/python/number_radians.htm below:

Python math.radians() Method

Python math.radians() Method

The Python math.radians() method is used to convert an angle from degrees to radians.

In mathematics, a base number raised to an exponent is referred to as a power. The base number is the factor that is multiplied by itself, and the exponent indicates how many times the base number has been multiplied.

Syntax

Following is the syntax of Python math.radians() method −

math.radians(x)

Note − This function is not accessible directly, so we need to import math module and then we need to call this function using math static object.

Parameters Return Value

This method returns radian value of an angle.

Example 1

If we pass a positive value as an argument to this method, it returns a positive value. If the argument passed is negative, then a negative value is returned.

The following example shows the usage of the Python math.radians() method.

import math
print ("radians(3) : ",  math.radians(3))
print ("radians(-3) : ",  math.radians(-3))
print ("radians(math.pi) : ",  math.radians(math.pi))
print ("radians(-(math.pi/2)) : ",  math.radians(-(math.pi/2)))
print ("radians(math.pi/4) : ",  math.radians(math.pi/4))

When we run above program, it produces following result −

radians(3) :  0.0523598775598
radians(-3) :  -0.0523598775598
radians(math.pi) :  0.0548311355616
radians(-(math.pi/2)) :  -0.027415567780803774
radians(math.pi/4) :  0.0137077838904
Example 2

If we pass a NaN value or 0 as an argument to this method, it returns 0.

import math
num = 0
res = math.radians(num)
print ("The radian of 0 is: ", res)

While executing the above code we get the following output −

The radian of 0 is:  0.0
Example 3

In the following example we are passing float value as an argument to the radians() method.

import math
num = 78.56
res = math.radians(num)
print ("The radians of a float value is: ", res)

Following is an output of the above code −

The radians of a float value is:  1.3711306603667452
Example 4

In the example given below we have created a tuple and a list of elements. Then the radians() method is used to retrieve the radians of the tuple and list elements at the specified index:

import math
List = [874.44, 36.54, 38.84, 92.35, 9.9]
Tuple = (34, 576, 93, 85, 62)
print ("The radians of the first List item is: ", math.radians(List[0]))
print ("The radians of the fifth List item is: ", math.radians(List[4]))
print ("The radians of the second tuple item is: ", math.radians(Tuple[1]))

Output of the above code is as follows −

The radians of the first List item is:  15.261857111139216
The radians of the fifth List item is:  0.17278759594743864
The radians of the second tuple item is:  10.053096491487338

python_maths.htm


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4