Trigonometric and Angular Functions

You all must know about Trigonometric and how it may become difficult to find the values of sine and cosine values of any angle. Math module provides built-in functions to find such values and even to change the values between degrees and radians.

1. Finding sine, cosine, and tangent

sin(), cos(), and tan() functions returns the sine, cosine, and tangent of value passed as the argument. The value passed in this function should be in radians.

Example: This code first imports the math module, which provides a variety of mathematical functions. Then, it defines a variable a and assigns it the value of pi/6, where pi is the mathematical constant representing the ratio of a circle’s circumference to its diameter.

Python3

import math
a = math.pi/6
print ("The value of sine of pi/6 is : ", end="")
print (math.sin(a))
print ("The value of cosine of pi/6 is : ", end="")
print (math.cos(a))
print ("The value of tangent of pi/6 is : ", end="")
print (math.tan(a))

                    

Output:

The value of sine of pi/6 is : 0.49999999999999994
The value of cosine of pi/6 is : 0.8660254037844387
The value of tangent of pi/6 is : 0.5773502691896257

2. Converting values from degrees to radians and vice versa

  • degrees() function is used to convert argument value from radians to degrees.
  • radians() function is used to convert argument value from degrees to radians.

Example: This code imports the math module, which provides mathematical functions and constants. It then defines two variables: a and b. a is assigned the value of math.pi/6, which is approximately 0.5235987755982988 radians. b is assigned the value 30, which is 30 degrees.

Python3

import math
a = math.pi/6
b = 30
print ("The converted value from radians to degrees is : ", end="")
print (math.degrees(a))
print ("The converted value from degrees to radians is : ", end="")
print (math.radians(b))

                    

Output:

The converted value from radians to degrees is : 29.999999999999996
The converted value from degrees to radians is : 0.5235987755982988

Refer to the below articles to get detailed information about the trigonometric and angular functions.

Python Math Module

Math Module consists of mathematical functions and constants. It is a built-in module made for mathematical tasks.

The math module provides the math functions to deal with basic operations such as addition(+), subtraction(-), multiplication(*), division(/), and advanced operations like trigonometric, logarithmic, and exponential functions.

In this article, we learn about the math module from basics to advanced, we will study the functions with the help of good examples.

Table of Content

  • What is a Math Module in Python?
  • Constants in Math Module
  • List of Mathematical function in Math Module
  • Numeric Functions in Math Module
  • Logarithmic and Power Functions
  • Trigonometric and Angular Functions
  • Special Functions

Similar Reads

What is a Math Module in Python?

Math Module is an in-built Python library made to simplify mathematical tasks in Python....

Constants in Math Module

...

List of Mathematical function in Math Module

The Python math module provides various values of various constants like pi, and tau. We can easily write their values with these constants. The constants provided by the math module are :...

Numeric Functions in Math Module

...

Logarithmic and Power Functions

...

Trigonometric and Angular Functions

...

Special Functions

...