Q:

Write a NumPy program to compute the trigonometric sine, cosine and tangent array of angles given in degrees

0

Write a NumPy program to compute the trigonometric sine, cosine and tangent array of angles given in degrees.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
print("sine: array of angles given in degrees")
print(np.sin(np.array((0., 30., 45., 60., 90.)) * np.pi / 180.))
print("cosine: array of angles given in degrees")
print(np.cos(np.array((0., 30., 45., 60., 90.)) * np.pi / 180.))
print("tangent: array of angles given in degrees")
print(np.tan(np.array((0., 30., 45., 60., 90.)) * np.pi / 180.))

Sample Output:

sine: array of angles given in degrees                                 
[ 0.          0.5         0.70710678  0.8660254   1.        ]          
cosine: array of angles given in degrees                               
[  1.00000000e+00   8.66025404e-01   7.07106781e-01   5.00000000e-01   
   6.12323400e-17]                                                     
tangent: array of angles given in degrees                              
[  0.00000000e+00   5.77350269e-01   1.00000000e+00   1.73205081e+00   
   1.63312394e+16]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now