NumPy Tutorial · NumPy ufunc

ufunc Trigonometric

Learn all about ufunc Trigonometric in this comprehensive tutorial.

5 min read advanced
  • NumPy provides the ufuncs sin(), cos() and tan() that take values in radians and produce the corresponding sin, cos and tan values.
  • By default all of the trigonometric functions take radians as parameters but we can convert radians to degrees and vice versa as well in NumPy.
  • Finding angles from values of sine, cos, tan.
  • Finding hypotenues using pythagoras theorem in NumPy.

Trigonometric Functions

NumPy provides the ufuncs sin(), cos() and tan() that take values in radians and produce the corresponding sin, cos and tan values.

python
python

Convert Degrees Into Radians

By default all of the trigonometric functions take radians as parameters but we can convert radians to degrees and vice versa as well in NumPy.

Note: Note: radians values are pi/180 * degree_values.
python

Radians to Degrees

python

Finding Angles

Finding angles from values of sine, cos, tan. E.g. sin, cos and tan inverse (arcsin, arccos, arctan).

NumPy provides ufuncs arcsin(), arccos() and arctan() that produce radian values for corresponding sin, cos and tan values given.

python

Angles of Each Value in Arrays

python

Hypotenues

Finding hypotenues using pythagoras theorem in NumPy.

NumPy provides the hypot() function that takes the base and perpendicular values and produces hypotenues based on pythagoras theorem.

python

Module quiz

2 questions
1

Which of the following is true about ufunc Trigonometric?

2

What is the most common pitfall when working with ufunc Trigonometric?

Answer all questions to submit.