I wonder if someone has a good strategy for backsubstituting?
For instance, deﬁne f(x,y,z) = sqrt(x**2+y**2+z**2) and then take a derivative of a function such as diff(f(x,y,z),x). At this point I would like to back substitute for f, i.e., remove sqrt(x**2+y**2+z**2) where ever it occurs and replace it with f.
I ﬁnd that I need contortions involving subs(%1=f,...); and that this trial and error procedure is not pedagogically reasonable.
Is there a scheme for doing this kind of back substitition so that physically meaningful variables can be employed consistently in the manner which pencil and paper work is done in physics and chemistry?
I think this is a very general problem in Maple. You may try using the alias function, but that is certainly not a ﬁnal solution:
Maple automatically substitutes the subexpression 1/sqrt(...) by a. Note that unfortunately alias( a=sqrt(...) ) does not work because of the internal structure of Maple expressions. But subs does not work also:
1/sqrt(...); subs( sqrt(...)=b ); 1/sqrt(...)
I and certainly many Maple users have the problem of really ”intelligent” backsubstitution in a way like ”Find the most simple expressions using these substitutions or functions ...”. E.g. if should be possible to ﬁnd out that x^4+y^2 should be expressed by f(x^2,y) if f(x,y)=x^2+y^2 has been previously deﬁned or given as a possible substitution.
comment and a caveat. ASSUMING the range/characteristics of a variable does not make it so in the ’eyes’ of ”whattype”. This is, I believe, an error on Maple’s part. It screws up the performance of such programs as BesselI(n,x) when n is only ASSUMEd integer, not TYPEd integer.