This repository has been archived by the owner on Oct 23, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nestor Velez
committed
Oct 14, 2018
1 parent
e0b2066
commit ee43704
Showing
11 changed files
with
22 additions
and
27 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import numpy as np | ||
import os | ||
import math | ||
|
||
def dot_product(a,b): | ||
return(a[0]*b[0]+a[1]*b[1]+a[2]*b[2]) | ||
|
||
def angle(a,b): | ||
dot=dot_product(a,b) | ||
mag_a=(a[0]**2+a[1]**2+a[2]**2)**0.5 | ||
mag_b=(b[0]**2+b[1]**2+b[2]**2)**0.5 | ||
return math.acos(dot/(mag_a*mag_b)) | ||
a=np.zeros(3) | ||
b=np.zeros(3) | ||
print("Use Rectangular Coordinats x, y and z") | ||
for i in range(3): | ||
a[i]=int(input("write the"+str(i)+"element of a")) | ||
b[i]=int(input("write the"+str(i)+"element of b")) | ||
print("The vectors are\n",a,"\n",b) | ||
print("Dot Product is", dot_product(a,b)) | ||
print("Angle between two vectors is (in radians)", angle(a,b), "and in degrees",(180/math.pi)*angle(a,b)) | ||
import numpy as np | ||
import os | ||
import math | ||
|
||
def dot_product(a,b): | ||
return(a[0]*b[0]+a[1]*b[1]+a[2]*b[2]) | ||
|
||
def angle(a,b): | ||
dot=dot_product(a,b) | ||
mag_a=(a[0]**2+a[1]**2+a[2]**2)**0.5 | ||
mag_b=(b[0]**2+b[1]**2+b[2]**2)**0.5 | ||
return math.acos(dot/(mag_a*mag_b)) | ||
a=np.zeros(3) | ||
b=np.zeros(3) | ||
print("Use Rectangular Coordinats x, y and z") | ||
for i in range(3): | ||
a[i]=int(input("write the"+str(i)+"element of a")) | ||
b[i]=int(input("write the"+str(i)+"element of b")) | ||
print("The vectors are\n",a,"\n",b) | ||
print("Dot Product is", dot_product(a,b)) | ||
print("Angle between two vectors is (in radians)", angle(a,b), "and in degrees",(180/math.pi)*angle(a,b)) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Hello world in Crystal | ||
|
||
puts "Hello World" | ||
puts "Hello World" |