0
0
NumPydata~30 mins

Trigonometric functions (sin, cos, tan) in NumPy - Mini Project: Build & Apply

Choose your learning style9 modes available
Trigonometric functions (sin, cos, tan)
📖 Scenario: You are analyzing angles in degrees and want to find their sine, cosine, and tangent values using Python. This is useful in many fields like physics, engineering, and computer graphics.
🎯 Goal: Build a small program that converts a list of angles from degrees to radians, then calculates the sine, cosine, and tangent for each angle using numpy.
📋 What You'll Learn
Create a list of angles in degrees
Create a variable for converting degrees to radians
Use numpy to calculate sine, cosine, and tangent for each angle
Print the results clearly
💡 Why This Matters
🌍 Real World
Trigonometric functions are used in physics to analyze waves, in engineering for signal processing, and in computer graphics for rotations and animations.
💼 Career
Understanding how to calculate and use trigonometric functions is important for data scientists working with time series, spatial data, or any domain involving angles and periodic behavior.
Progress0 / 4 steps
1
Create a list of angles in degrees
Create a list called angles_degrees with these exact values: 0, 30, 45, 60, 90.
NumPy
Need a hint?

Use square brackets [] to create a list and separate values with commas.

2
Create a variable to convert degrees to radians
Import numpy as np and create a variable called angles_radians that converts angles_degrees to radians using np.radians().
NumPy
Need a hint?

Use import numpy as np to import numpy. Then use np.radians() to convert degrees to radians.

3
Calculate sine, cosine, and tangent values
Using angles_radians, create three variables called sine_values, cosine_values, and tangent_values that store the sine, cosine, and tangent of each angle using np.sin(), np.cos(), and np.tan() respectively.
NumPy
Need a hint?

Use numpy functions np.sin(), np.cos(), and np.tan() on the radians array.

4
Print the sine, cosine, and tangent values
Print the variables sine_values, cosine_values, and tangent_values each on a separate line.
NumPy
Need a hint?

Use three print() statements, one for each variable.