Message Boards Message Boards

0
|
3560 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

How to Replace[] the entire denominator?

Posted 4 years ago

Hi Everybody,

d1= U/((a - b - c) (a + b - c) (a - b + 
       c) (a + b + c)) /. {(a - b - c) (a + b - c) (a - b + c) (a + b + c) -> -4*S^2};

Any way to replace the entire denominator and obtain

-U/(4*S^2)

?

Thanks in advance and best regards,

César Lozada

POSTED BY: Cesar Lozada
2 Replies
Posted 4 years ago

Hi Bill,

Thanks!

Your post suggests me I have to break the expression:

d1 = U/((a - b - c) (a + b - c) (a - b + c) (a + b + c));
repl = {(a - b - c) (a + b - c) (a - b + c) (a + b + c) -> -4*S^2};
num = Numerator[d1] /. repl;
den = Denominator[d1] /. repl;
d1 = num/den

And it works!!!

Output: -(U/(4 S^2))

Many thanks again,

César Lozada

POSTED BY: Cesar Lozada
Posted 4 years ago

Sometimes in Mathematica denominators are not in the form you might expect.

We can use FullForm to see how Mathematica represents your expression internally

d1= U/((a - b - c) (a + b - c) (a - b +c) (a + b + c));
FullForm[d1]

which shows us that Mathematica sees this internally in this form:

Times[
  Power[Plus[a,Times[-1,b],Times[-1,c]],-1],
  Power[Plus[a,b,Times[-1,c]],-1],
  Power[Plus[a,Times[-1,b],c],-1],
  Power[Plus[a,b,c],-1],
  U]

So, since Mathematica has this is in the form of U*stuff, here is one way you can do this

d1/.U*stuff_->U/(-4*S^2)

which returns the result that you wanted

-U/(4 S^2)
POSTED BY: Bill Nelson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract