Merge branch 'master' into addfunc

This commit is contained in:
Luke Weiler
2020-10-19 09:29:27 -04:00
committed by GitHub
5 changed files with 45 additions and 12 deletions

View File

@@ -71,3 +71,5 @@ from .multiplyComplexNumbersFunc import *
from .geomProgrFunc import *
from .geometricMeanFunc import *
from .harmonicMeanFunc import *
from .euclidianNormFunc import *
from .angleBtwVectorsFunc import *

View File

@@ -0,0 +1,16 @@
from .euclidianNormFunc import euclidianNormFunc
import math
from .__init__ import *
def angleBtwVectorsFunc(v1: list, v2: list):
sum = 0
for i in v1:
for j in v2:
sum += i * j
mags = euclidianNormFunc(v1) * euclidianNormFunc(v2)
problem = f"angle between the vectors {v1} and {v2} is:"
solution = math.acos(sum / mags)
# would return the answer in radians
return problem, solution

View File

@@ -0,0 +1,7 @@
from .__init__ import *
def euclidianNormFunc(v1: list):
problem = f"Euclidian norm or L2 norm of the vector{v1} is:"
solution = sqrt(sum([i**2 for i in v1]))
return problem, solution