added vector dot product

This commit is contained in:
midhun varman
2020-10-19 13:04:44 +05:30
parent 3ba50015ef
commit ab960534f9
3 changed files with 15 additions and 0 deletions

View File

@@ -71,3 +71,4 @@ from .multiplyComplexNumbersFunc import *
from .geomProgrFunc import * from .geomProgrFunc import *
from .geometricMeanFunc import * from .geometricMeanFunc import *
from .harmonicMeanFunc import * from .harmonicMeanFunc import *
from .vectorDotFunc import *

View File

@@ -0,0 +1,13 @@
from .__init__ import *
def vectorDotFunc(minVal=-20, maxVal=20):
a = [random.randint(minVal, maxVal) for i in range(3)]
b = [random.randint(minVal, maxVal) for i in range(3)]
c = [a[0] * b[0],
a[1] * b[1] ,
a[2] * b[2] ]
problem = str(a) + " . " + str(b) + " = "
solution = str(c)
return problem, solution

View File

@@ -156,3 +156,4 @@ complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x +
geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc)
geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc)
harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc)
vectorDot = Generator("Dot Product of 2 Vectors",68, "a . b = ", "c", vectorDotFunc)