Message Boards Message Boards

4 Replies
9 Total Likes
View groups...
Share this post:

Simplification/change of representation of formulas

Posted 11 years ago
I would like to transform/write the equation for H1 into the form of H2?
I asked a colleague who's relatively knowledgable in Mathematica, but he couldn't tell me how if at all. Below is a simplified example for my question:
A = (M - N)/M
B = (M + N)
H1 = Z*(M - N)/(1 + Z*M + Z*B)
H2 = A*(1/(1/(Z*M) + 3 - A))
G1 = Simplify[H1]
G2 = Simplify[H2]
G1 == G2
The definitions for A and B are basic ones and H1 emerges from some other calculations. So, I do NOT want to change the definitions of A nor B. But from this moment on, I want Mathematica to use the representation of the past calculations using H2. Thanks for your help.

G1 and G2 are just there to check that H1 and H2 are equal and that I didn't do a typing error.
POSTED BY: Ulrich Müller
4 Replies
In these sorts of situations, where your pattern is not really matching everything you want it to, you can try to replace instead what is inside the pattern, e.g., try the rule you get from Solve (and then Simplify)

Solve[{A == (M - N)/M, B == M + N}, {M, N}]
POSTED BY: Todd Rowland
Posted 11 years ago
Thanks Todd, but this is not what I want/need.

This is what came out (after correcting your formula, supposing that my correction is correct):
Reduce[{A == (M - N)/M, B == M + N, Z*(M - N)/(1 + Z*M + Z*B) == A*(1/(1/(Z*M) + F3))}, F3]

(M == N && 1 + 3 N Z + F3 N Z + 3 F3 N^2 Z^2 != 0) || (N == 0 &&
   M == 0) || (M != 0 && F3 == (2 M + N)/M && 1 + 2 M Z + N Z != 0) ||
  Z == 0
And this still looks ugly as hell.

The goal I want to get to above, is, the formula has a prefactor A (important), and the rest (which is kind of a correction factor) got rid of the B .
I would expect a command like Replace[H1, (M-N)/M -> A] which should result in H2.
But this gives only:
Replace[H1, (M - N)/M -> A]

((M - N) Z)/(1 + M Z + (M + N) Z)

Remark: All variables are >0 and M>N (but this is a minor detail).
POSTED BY: Ulrich Müller
If Simplify does not do what you want, try Expand and Together.

 In[1]:= A = (M - N)/M;
 B = (M + N);
 H1 = Z*(M - N)/(1 + Z*M + Z*B);
 H2 = A*(1/(1/(Z*M) + 3 - A));
 In[5]:= G1 = Simplify[H1]
 Out[5]= ((M - N) Z)/(1 + 2 M Z + N Z)
 In[6]:= G2 = Simplify[H2]
Out[6]= ((M - N) Z)/(1 + 2 M Z + N Z)

In[8]:= G1 == G2
Out[8]= True

In[7]:= $Version
Out[7]= "9.0 for Mac OS X x86 (64-bit) (January 24, 2013)"
POSTED BY: Bruce Miller
It is not clear because you already know what H2 is.  Here is an example if you only knew that

H2==A*(1/(1/(Z*M) + F3))

then find F3

Reduce[{A == (M - N)/M, B == M + N,   Z*(M - N)/(1 + Z*M + Z  M  == A*(1/(1/(Z*M) + F3))}, F3]
POSTED BY: Todd Rowland
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract