- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to find cosine of an angle using Python?
Python comes with an amazing standard math library that provides all trigonometric functions like sin, cos, etc. You can import that library and use these functions. Note that these functions expect angles in radians. For example,
import math angle1 = math.radians(90) angle2 = math.radians(60) print(math.cos(angle1)) print(math.cos(angle2))
This will give the output:
6.123233995736766e-17 0.5
The first value is very close to zero. Such errors come due to computation limits.
- Related Articles
- How to find discrete cosine transform of an image using OpenCV Python?
- Get the Trigonometric cosine of an angle in Python
- Get the arc cosine of an angle in Java
- How to plot an angle spectrum using Matplotlib in Python?
- How to set the angle of an Image using FabricJS?
- How to find the Arc Cosine of a given value in Golang?
- How to find the cosine of a given radian value in Golang?
- C program to find out cosine and sine values using math.h library.
- How to set the angle of rotation of an Ellipse using FabricJS?
- How to find contours of an image using scikit-learn in Python?
- How to find the Fourier Transform of an image using OpenCV Python?
- Get the Trigonometric cosine of an array of angles given in degrees with Python
- How to find the Hyperbolic Arc Cosine of a given value in Golang?
- How to find the Hyperbolic Cosine of a given radian value in Golang?
- How to compute the inverse cosine and inverse hyperbolic cosine in PyTorch?

Advertisements