Open
Description
Sage is not able to identify partial sum in a substitution
sage: var('x,y')
sage: f = x + x^2 + x^4
sage: f.subs(x^2 == y) # one term is fine
x^4 + x + y
sage: f.subs(x + x^2 == y) # partial sum does not work
x^4 + x^2 + x
sage: f.subs(x + x^2 + x^4 == y) # whole sum is fine
y
Similarly with products
sage: f = x * cos(x) * sin(x)
sage: f.subs( cos(x) * sin(x) == y)
x*cos(x)*sin(x)
As mentioned in the doc, this is the same behavior as in Maple but differ from Mathematica. We should be clearer on the semantic of substitute
and potentially implement partial sum and product substitutions.
See also #10049 and http://ask.sagemath.org/question/25972/substitute-xy-by-u/ (with related ticket #17879)
CC: @orlitzky @mezzarobba
Component: symbolics
Issue created by migration from https://trac.sagemath.org/ticket/18396