Re: Replacement

*To*: mathgroup at smc.vnet.net*Subject*: [mg4477] Re: Replacement*From*: rubin at msu.edu (Paul A. Rubin)*Date*: Mon, 29 Jul 1996 02:37:29 -0400*Organization*: Michigan State University*Sender*: owner-wri-mathgroup at wolfram.com

In article <4shud7$g7n at ralph.vnet.net>, ges at vsnhdd.cern.ch (Sergej Gerassimov) wrote: ->Hi, -> ->I have something like -> ->x/Sqrt[a^2+b^2]+Sqrt[a^2+b^2]/y -> ->and I'd like to substitute Sqrt[a^2+b^2] by r. -> ->x/Sqrt[a^2+b^2]+Sqrt[a^2+b^2]/y //. Sqrt[a^2+b^2]->r ->gives: -> -> x r ->------------- + - ->Sqrt[a^2+b^2] y -> ->(replace one only in the numerator) ->How to replace Sqrt[a^2+b^2] by r everywhere in the expression? -> ->Thanks. -> S. In[]:= x/Sqrt[a^2+b^2]+Sqrt[a^2+b^2]/y //. (a^2+b^2)^Rational[ n_, 2 ] -> r^n Out[]= x r - + - r y Paul ************************************************************************** * Paul A. Rubin Phone: (517) 432-3509 * * Department of Management Fax: (517) 432-1111 * * Eli Broad Graduate School of Management Net: RUBIN at MSU.EDU * * Michigan State University * * East Lansing, MI 48824-1122 (USA) * ************************************************************************** Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. J. W. v. GOETHE ==== [MESSAGE SEPARATOR] ====