scalar expected, use tensorproduct(...) for tensorial product
Package:
sympy
8356
Exception Class:
ValueError
Raise code
def __mul__(self, other):
from sympy.matrices.matrices import MatrixBase
from sympy.tensor.array import SparseNDimArray
from sympy.tensor.array.arrayop import Flatten
if isinstance(other, (Iterable, NDimArray, MatrixBase)):
raise ValueError("scalar expected, use tensorproduct(...) for tensorial product")
other = sympify(other)
if isinstance(self, SparseNDimArray):
if other.is_zero:
return type(self)({}, self.shape)
return type(self)({k: other*v for (k, v) in self._sparse_array.items()}, self.shape)
Links to the raise (2)
https://github.com/sympy/sympy/blob/2c83657ff1c62fc2761b639469fdac7f7561a72a/sympy/tensor/array/ndim_array.py#L417 https://github.com/sympy/sympy/blob/2c83657ff1c62fc2761b639469fdac7f7561a72a/sympy/tensor/array/ndim_array.py#L434NO FIXES YET
Just press the button and we will add solution
to this exception as soon as possible
* As many users press the button, the faster we create a fix
Add a possible fix
Please authorize to post fix