Open In App

Mathematical Functions in Python | Set 3 (Trigonometric and Angular Functions)

Last Updated : 28 Jul, 2016
Improve
Improve
Like Article
Like
Save
Share
Report

Some of the mathematical functions are discussed in below set 1 and set 2

Mathematical Functions in Python | Set 1 (Numeric Functions)
Mathematical Functions in Python | Set 2 (Logarithmic and Power Functions)

Trigonometric and angular functions are discussed in this article.

1. sin() :- This function returns the sine of value passed as argument. The value passed in this function should be in radians.

2. cos() :- This function returns the cosine of value passed as argument. The value passed in this function should be in radians.




# Python code to demonstrate the working of
# sin() and cos()
   
# importing "math" for mathematical operations
import math
  
a = math.pi/6
   
# returning the value of sine of pi/6
print ("The value of sine of pi/6 is : ", end="")
print (math.sin(a))
   
# returning the value of cosine of pi/6
print ("The value of cosine of pi/6 is : ", end="")
print (math.cos(a))


Output:

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

3. tan() :- This function returns the tangent of value passed as argument. The value passed in this function should be in radians.

4. hypot(a, b) :- This returns the hypotenuse of the values passed in arguments. Numerically, it returns the value of sqrt(a*a + b*b).




# Python code to demonstrate the working of
# tan() and hypot()
   
# importing "math" for mathematical operations
import math
  
a = math.pi/6
b = 3
c = 4
   
# returning the value of tangent of pi/6
print ("The value of tangent of pi/6 is : ", end="")
print (math.tan(a))
   
# returning the value of hypotenuse of 3 and 4
print ("The value of hypotenuse of 3 and 4 is : ", end="")
print (math.hypot(b,c))


Output:

The value of tangent of pi/6 is : 0.5773502691896257
The value of hypotenuse of 3 and 4 is : 5.0

5. degrees() :- This function is used to convert argument value from radians to degrees.

6. radians() :- This function is used to convert argument value from degrees to radians.




# Python code to demonstrate the working of
# degrees() and radians()
   
# importing "math" for mathematical operations
import math
   
a = math.pi/6
b = 30
  
# returning the converted value from radians to degrees
print ("The converted value from radians to degrees is : ", end="")
print (math.degrees(a))
   
# returning the converted value from degrees to radians
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


Similar Reads

Mathematical Functions in Python | Set 2 (Logarithmic and Power Functions)
Numeric functions are discussed in set 1 below Mathematical Functions in Python | Set 1 ( Numeric Functions) Logarithmic and power functions are discussed in this set. 1. exp(a) :- This function returns the value of e raised to the power a (e**a) . 2. log(a, b) :- This function returns the logarithmic value of a with base b. If base is not mentione
3 min read
Mathematical Functions in Python | Set 4 (Special Functions and Constants)
Some of the mathematical functions are discussed in below set 1, set 2 and set 3 Mathematical Functions in Python | Set 1 (Numeric Functions) Mathematical Functions in Python | Set 2 (Logarithmic and Power Functions) Mathematical Functions in Python | Set 3 (Trigonometric and Angular Functions) Special Functions and constants are discussed in this
2 min read
Mathematical Functions in Python | Set 1 (Numeric Functions)
In python a number of mathematical operations can be performed with ease by importing a module named "math" which defines various functions which makes our tasks easier. 1. ceil() :- This function returns the smallest integral value greater than the number. If number is already integer, same number is returned. 2. floor() :- This function returns t
3 min read
Complex Numbers in Python | Set 3 (Trigonometric and Hyperbolic Functions)
Some of the Important Complex number functions are discussed in the articles below Complex Numbers in Python | Set 1 (Introduction) Complex Numbers in Python | Set 2 (Important Functions and constants) Trigonometric and Hyperbolic Functions are discussed in this article. Trigonometric Functions 1. sin() : This function returns the sine of the compl
4 min read
Python | Mathematical Median of Cumulative Records
Sometimes, while working with Python tuple list, we can have a problem in which we need to find the median of tuple values in the list. This problem has the possible application in many domains including mathematics. Let’s discuss certain ways in which this task can be performed. Method #1 : Using loops + "~" operator This task can be performed in
8 min read
Plot Mathematical Expressions in Python using Matplotlib
For plotting equations we will use two modules Matplotlib.pyplot and Numpy. This module helps you to organize your Python code logically. Numpy Numpy is a core library used in Python for scientific computing. This Python library supports you for a large, multidimensional array object, various derived objects like matrices and masked arrays, and ass
5 min read
Evaluate the Mathematical Expressions using Tkinter in Python
This article focuses on the evaluation of mathematical expression using the Tkinter and math packages in Python. Tkinter: Python Tkinter is a GUI programming package or built-in package. Tkinter provides the Tk GUI toolkit with a potent object-oriented interface. Python with Tkinter is the fastest and easiest way to create GUI applications. Creatin
2 min read
Python | Trigonometric operations in excel file using openpyxl
Prerequisite : Adjusting rows and columns of an excel sheet using openpyxl. Openpyxl is a Python library using which one can perform multiple operations on excel files like reading, writing, mathematical operations and plotting graphs. Let’s see how to perform different Trigonometric operations using openpyxl. Simple trigonometric functions : Code
3 min read
Mathematical Foundations in Tensorflow
Before constructing a basic TensorFlow program, it's critical to grasp the mathematical ideas required for TensorFlow. Any machine learning algorithm's core is considered mathematics. A strategy or solution for a certain machine learning algorithm is established with the aid of key mathematical principles. Let's dive into the mathematical foundatio
4 min read
How to define a mathematical function in SymPy?
SymPy is a Python Library that makes 'Symbolic Computation' possible in Python. Mathematical Functions using SymPy We can define mathematical functions by using SymPy in Python. There are two types of functions that we can define with the help of SymPy: 'Undefined Functions' and 'Custom Functions'. Undefined Functions: A programmer can create 'Unde
4 min read
Article Tags :
Practice Tags :
three90RightbarBannerImg