How hard is to program that given a symbolic expression like
$$ f = x^2 + y^2 + k \, , $$ I could teach to Maple that $x^2 + y^2 = r^2$ and then it expresses f like
$$ f = r^2 + k \, ? $$
Of course I want to implement it for more difficult expressions but this would be a good start.
If you expressions are polynomials then you can apply the
algsubscommand to get that form.A more powerful way to obtain
fexpressed like that, which will work for a broader class of expressions, is to simplify it under side relations. Eg,A more automatic mechanism is to use the
aliascommand. Here we just invokealiasonce at the start, and then subsequently the expression shows in the desired form without having to apply another special command. Eg,The
r^2on the RHS can be computationally combined with instance ofr^2itself.But here is a drawback (which you might consider serious): it'd be nicer if the RHS of the following were displayed just as
x^2 + k.