Files
mathgenerator/mathgenerator/funcs/algebra/vector_cross.py
Luke Weiler 20d3294a93 Remove asterisk imports from subject inits (#391)
* removed asterisk imports from subject inits

* import Generator from the right init level
2022-12-19 02:06:10 -05:00

25 lines
692 B
Python

from ...__init__ import Generator
import random
def gen_func(minVal=-20, maxVal=20, format='string'):
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]
]
if format == 'string':
problem = str(a) + " X " + str(b) + " = "
solution = str(c)
return problem, solution
elif format == 'latex':
return "Latex unavailable"
else:
return a, b, c
vector_cross = Generator("Cross Product of 2 Vectors", 43, gen_func,
["minVal=-20", "maxVal=20"])