Recently I have been using numpy's .cross function to multiply vectors. However, the function doesn't support non-numerical elements for the arrays, i.e a=[5t,6,0]. I was wondering if it was possible to, in Python, calculate such operations with maybe another function, or another method. Any suggestions?
CodePudding user response:
You can do it with SymPy module of Python.
import sympy
t = sympy.symbols('t')
a = sympy.Matrix([5*t,6,0])
b = sympy.Matrix([8*t**2, 3, 5])
print(a.cross(b))
Output:
Matrix([
[ 30],
[ -25*t],
[-48*t**2 15*t]])