Re: Replacement
- To: mathgroup at smc.vnet.net
- Subject: [mg4422] Re: Replacement
- From: wagner at motel6.cs.colorado.edu (Dave Wagner)
- Date: Mon, 22 Jul 1996 00:09:22 -0400
- Organization: University of Colorado, Boulder
- Sender: owner-wri-mathgroup at wolfram.com
Whoops, in my previous post I gave the wrong output: In article <4snbf1$rra at dragonfly.wolfram.com>, Dave Wagner <wagner at motel6.cs.colorado.edu> wrote: >In article <4shud7$g7n at ralph.vnet.net>, >Sergej Gerassimov <ges at vsnhdd.cern.ch> wrote: >> >>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 >> >>How to replace Sqrt[a^2+b^2] by r everywhere in the expression? > >A general solution to this type of problem is to introduce a dummy >variable and use Solve: > > In[15]:= > Solve[{dummy==x/Sqrt[a^2+b^2]+Sqrt[a^2+b^2]/y, r==Sqrt[a^2+b^2]}, > {dummy},{a,b}] > > Out[15]= > x r > ------------- + - > 2 2 y > Sqrt[a + b ] That output should have been: Out[1]= x r {{dummy -> - + -}} r y I was cutting and pasting all over the place and I must have inadvertently included the wrong output in my post. Sorry for any confusion. Dave Wagner Principia Consulting (303) 786-8371 dbwagner at princon.com http://www.princon.com/princon ==== [MESSAGE SEPARATOR] ====