Should we allow

x = Matrix(....)
y = simplify(x)  ?

How about

x = ImmutableMatrix(...)
y = simplify(x)  ?

Historically the first has never worked but the second did work for the
last few months because of an odd inheritance tree. I'm currently proposing
a PR which removes the ImmutableMatrix inherits from Expr link so
simplify(ImmutableMatrix) will cease to function. Also we have always had,
(and will continue to have

ImmutableMatrix.simplify()

The core issue is that simplify was written with scalar expressions in
mind. It (indirectly) calls methods like `as_numer_denom` that assumes that
what you're working with is a scalar. This has worked on ImmutableMatrix in
the past because ImmutableMatrix inherited from Expr in order to get a few
nice features.  A lot of things sort of worked and covered up a few
problems. In a new PR I cut this inheritance so this question opens up
again.

I see two options:
1. Do not allow simplify(x) syntax where x is not an Expr
2. Add a shortcut `if hasattr(x, '_simplify'): return x._simplify()` to the
top of simplify
3. Someone else suggests something better than 1 or 2

Do we want the function simplify to be just for exprs or do we want it to
be for all sorts of things? If we want it to be for all sorts of things
what is the best way to handle the polymorphism?

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to