Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nsolve does not accept starting vector of type Matrix #14950

Closed
yashabk opened this issue Jul 20, 2018 · 0 comments · Fixed by #15529
Closed

nsolve does not accept starting vector of type Matrix #14950

yashabk opened this issue Jul 20, 2018 · 0 comments · Fixed by #15529

Comments

@yashabk
Copy link

yashabk commented Jul 20, 2018

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])

See this stackoverflow post for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant