Message Boards Message Boards

3 Replies
0 Total Likes
View groups...
Share this post:

replacing a ratio

Posted 9 years ago

hi, I have an expression that contains a lot of parameters. among these parameters, a have (a/b) and i would like to replace it with one term (w). is there a command in mathematica that i can use it to replace it? thanks.

POSTED BY: djouaher zo
3 Replies
In[1]:= (3 + a/b) /. a -> b*w

Out[1]= 3 + w
POSTED BY: Frank Kampas

If you have

In[275]:= (a + (a/b)^2) /. a -> b*w

Out[275]= b w + w^2

But if you add another /. b*w -> a

In[267]:= (a + (a/b)^2) /. a -> b*w /. b*w -> a

Out[267]= a + w^2


POSTED BY: Eric Johnstone

That's because it can't match b*w to w^2 but:

In[1]:= (a + (a/b)^2) /. a -> b*w /. w -> a/b

Out[1]= a + a^2/b^2
POSTED BY: Kay Herbert
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract