Group Abstract Group Abstract

Message Boards Message Boards

0
|
11.3K Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Substitute a term in an equation

Hello all,

I am trying to replace a term in an equation with a single letter. For example:

R=(a+b)/(c0-c1+g)^2

I want to replace (c0-c1+g)^2 with AA, so that the resulting expression will be:

 R=(a+b)/A

How can I do that?

Best regards

Konstantinos

2 Replies

Another way, using Solve:

(a + b)/(c0 - c1 + g)^2 /. Solve[(c0 - c1 + g)^2 == A, c0]
POSTED BY: Gianluca Gorni
Posted 10 years ago

Here is the sentence I always repeat to myself:

When replacement doesn't work look at the FullForm.

In[1]:= R = (a + b)/(c0 - c1 + g)^2;
FullForm[R]

Out[2]//FullForm= Times[Plus[a, b], Power[Plus[c0, Times[-1, c1], g], -2]]

For your example I want to replace that Power term with another term. But I want that new term to remain in the denominator so I still want that to have an exponent. So I try this

In[3]:= R = R /. Power[Plus[c0, Times[-1, c1], g], -2] -> A^-1

Out[3]= (a + b)/A

And that worked on the first try! That is often not the case.

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard