You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
nsolve gives a TypeError when given a Matrix for the starting vector, requiring instead a manual conversion to a list via v0.T.tolist()[0]. Notably, nsolve is fine with a Matrix expression for the equation.
A minimal example:
import sympy as sy
v = sy.Matrix(sy.symarray("v", (2,)))
w = sy.Matrix([17, 23])
equation = v - w
The following line gives a TypeError: cannot create mpf from Matrix([[17],[23]]): sy.nsolve(equation, v, w)
The following line gives the correct output, Matrix([[17.0],[23.0]]): sy.nsolve(equation, v, w.T.tolist()[0])
nsolve gives a TypeError when given a Matrix for the starting vector, requiring instead a manual conversion to a list via
v0.T.tolist()[0]
. Notably, nsolve is fine with a Matrix expression for the equation.A minimal example:
The following line gives a
TypeError: cannot create mpf from Matrix([[17],[23]])
:sy.nsolve(equation, v, w)
The following line gives the correct output,
Matrix([[17.0],[23.0]])
:sy.nsolve(equation, v, w.T.tolist()[0])
See this stackoverflow post for more details.
The text was updated successfully, but these errors were encountered: