We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When I call sympy.expand() on a matrix, all matrix elements get expanded, as expected.
sympy.expand()
However, when I call sympy.factor(), nothing happens?
sympy.factor()
>>> import sympy as sp >>> a, b = sp.symbols('a b') >>> one = sp.Matrix([(a - b)**2]) >>> one Matrix([[(a - b)**2]]) >>> two = sp.expand(one) >>> two Matrix([[a**2 - 2*a*b + b**2]]) >>> sp.factor(two) Matrix([[a**2 - 2*a*b + b**2]])
Expected result:
>>> sp.factor(two) Matrix([[(a - b)**2]])
Am I doing something wrong?
I'm using the master branch of SymPy.
master
The text was updated successfully, but these errors were encountered:
The method M.applyfunc(factor) could probably be used.
M.applyfunc(factor)
Sorry, something went wrong.
See #18181
Thanks for the quick answers!
It's good to know that this is a known issue. I will try to use applyfunc() in the meantime.
applyfunc()
@oscarbenjamin I would like to add .factor() to matrix if needed because after reading #18181 I'm not sure if it's needed or not . Shall I?
No branches or pull requests
When I call
sympy.expand()
on a matrix, all matrix elements get expanded, as expected.However, when I call
sympy.factor()
, nothing happens?Expected result:
Am I doing something wrong?
I'm using the
master
branch of SymPy.The text was updated successfully, but these errors were encountered: