Merge pull request #109 from danielmsorensen/master

Add Vector Cross Product
This commit is contained in:
Luke Weiler
2020-10-16 18:47:47 -04:00
committed by GitHub

View File

@@ -597,6 +597,14 @@ def permutationFunc(maxlength=20):
problem= "Number of Permutations from {} objects picked {} at a time = ".format(a,b) problem= "Number of Permutations from {} objects picked {} at a time = ".format(a,b)
return problem, solution return problem, solution
def vectorCrossFunc(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[1]*b[2] - a[2]*b[1],
a[2]*b[0] - a[0]*b[2],
a[0]*b[1] - a[1]*b[0]]
return str(a) + " X " + str(b) + " = ", str(c)
# || Class Instances # || Class Instances
#Format is: #Format is:
@@ -645,3 +653,4 @@ volumeConeGen = Generator("Volume of cone", 39, "Volume of cone with height = a
commonFactors = Generator("Common Factors", 40, "Common Factors of {a} and {b} = ","[c, d, ...]",commonFactorsFunc) commonFactors = Generator("Common Factors", 40, "Common Factors of {a} and {b} = ","[c, d, ...]",commonFactorsFunc)
intersectionOfTwoLines = Generator("Intersection of Two Lines", 41, "Find the point of intersection of the two lines: y = m1*x + b1 and y = m2*x + b2", "(x, y)", intersectionOfTwoLinesFunc) intersectionOfTwoLines = Generator("Intersection of Two Lines", 41, "Find the point of intersection of the two lines: y = m1*x + b1 and y = m2*x + b2", "(x, y)", intersectionOfTwoLinesFunc)
permutations= Generator("Permutations",42, "Total permutations of 4 objects at a time from 10 objects is","5040", permutationFunc) permutations= Generator("Permutations",42, "Total permutations of 4 objects at a time from 10 objects is","5040", permutationFunc)
vectorCross = Generator("Cross Product of 2 Vectors", 43, "a X b = ", "c", vectorCrossFunc)