We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1c25e31 commit 4c81b56Copy full SHA for 4c81b56
Vectors_functions.py
@@ -0,0 +1,18 @@
1
+import numpy as np
2
+import math
3
+a=np.array([1,2,3])
4
+b=np.array([4,5,6])
5
+dot_ab=np.dot(a,b)
6
+print("Dot Product is = ",dot_ab)
7
+cross_ab=np.cross(a,b)
8
+print("Cross Product is = ",cross_ab)
9
+mag_a = np.linalg.norm(a)
10
+mag_b = mag_a = np.linalg.norm(b)
11
+
12
+print("Magnitude of A: ",mag_a)
13
+print("Magnitude of B: ",mag_b)
14
+cos_theta = dot_ab / (mag_a * mag_b)
15
+ang_ab=np.arccos(cos_theta)
16
+angle_degree = np.degrees(ang_ab)
17
+print("Angle b/w AB (in radians) : ",ang_ab)
18
+print("Angle b/w AB (in degree) : " ,angle_degree)
0 commit comments