Comment #14 on issue 2552 by [email protected]: (1/(x*y)).subs(x*y, whatever)
doesn't work
http://code.google.com/p/sympy/issues/detail?id=2552
We have now:
1. automatic transformation of the expression in the core as it pointed in
#1 .
>>> 1/(x*y).args
(1/x, 1/y)
2. auto transformation while printing
>>> 1/x*1/y
1/(x*y)
If we did not have those (at least p 1.), then the issue would be resolved
obviously.
And the reasons for those are not well documented (I suppose that they are
present thought). And we must consider this reasons firstly, because they
prevent the right way of the substitution.
It could be called as explicit substitution for an given expression. No
thinking is needed in this case, just find x*y and replace them to whatever
(if the expression could not metamorphosed while its constructing, I
repeat).
3. The implicit substitution. When the substitution must be more
intelligible, e.g. for above Chris's examples (comment #12). But to my mind
the result will be differ:
>>> (1/x**2/y**3).subs(x*y, z)
1/y/z
>>> (1/x**3/y**2).subs(x*y, z)
1/x/z
Because the implied aim of the substitution is to collect all possible x*y
parts and substitute them to z.
And this will be work even we assume that 1 and 2 transformations continue
to work as now. (But it will be more complex way for obvious explicit
substitutions).
4. If we have the different definition of what the implicit substitution
must do exactly, then the question is raised what to do with 1, when
automatic transformation '1/(x*y)' --> '1/x*1/y' to is present.
5. Further we can discuss the algorithms for the realization of 3, but it
is hard to play with it, if we have auto transformation of the expression
in the core internally. So I re-raise the question about the reason of the
realization of 1 again.
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" 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-issues?hl=en.