diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 4250fdb..232b2ea 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -597,6 +597,14 @@ def permutationFunc(maxlength=20): problem= "Number of Permutations from {} objects picked {} at a time = ".format(a,b) 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 #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) 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) +vectorCross = Generator("Cross Product of 2 Vectors", 43, "a X b = ", "c", vectorCrossFunc)