Get mathematica to simplify expression with another equation

vector07 picture vector07 · Nov 10, 2011 · Viewed 17k times · Source

I have a very complicated mathematica expression that I'd like to simplify by using a new, possibly dimensionless parameter.

An example of my expression is:

K=a*b*t/((t+f)c*d);

(the actual expression is monstrously large, thousands of characters). I'd like to replace all occurrences of the expression t/(t+f) with p

p=t/(t+f);

The goal here is to find a replacement so that all t's and f's are replaced by p. In this case, the replacement p is a nondimensionalized parameter, so it seems like a good candidate replacement.

I've not been able to figure out how to do this in mathematica (or if its possible). I tried:

eq1= K==a*b*t/((t+f)c*d);
eq2= p==t/(t+f);
Solve[{eq1,eq2},K]

Not surprisingly, this doesn't work. If there were a way to force it to solve for K in terms of p,a,b,c,d, this might work, but I can't figure out how to do that either. Thoughts?


Edit #1 (11/10/11 - 1:30) [deleted to simplify]

OK, new tact. I've taken p=ton/(ton+toff) and multiplied p by several expressions. I know that p can be completely eliminated. The new expression (in terms of p) is

testEQ = A B p + A^2 B p^2 + (A+B)p^3;

Then I made the substitution for p, and called (normal) FullSimplify, giving me this expression.

testEQ2= (ton (B ton^2 + A^2 B ton (toff + ton) + 
   A (ton^2 + B (toff + ton)^2)))/(toff + ton)^3;

Finally, I tried all of the suggestions below, except the last (not sure how it works yet!)

Only the eliminate option worked. So I guess I'll try this method from now on. Thank you.

EQ1 = a1 == (ton (B ton^2 + A^2 B ton (toff + ton) + 
        A (ton^2 + B (toff + ton)^2)))/(toff + ton)^3;
EQ2 = P1 == ton/(ton + toff);
Eliminate[{EQ1, EQ2}, {ton, toff}]

A B P1 + A^2 B P1^2 + (A + B) P1^3 == a1

I should add, if the goal is to make all substitutions that are possible, leaving the rest, I still don't know how to do that. But it appears that if a substitution can completely eliminate a few variables, Eliminate[] works best.

Answer

Niki picture Niki · Nov 10, 2011

Have you tried this?

K = a*b*t/((t + f) c*d);
Solve[p == t/(t + f), t]
 -> {{t -> -((f p)/(-1 + p))}}

Simplify[K /. %[[1]] ]
 -> (a b p)/(c d)

EDIT: Oh, and are you aware of Eliminiate?

Eliminate[{eq1, eq2}, {t,f}]
 -> a b p == c d K && c != 0 && d != 0

Solve[%, K]
 -> {{K -> (a b p)/(c d)}}

EDIT 2: Also, in this simple case, solving for K and t simultaneously seems to do the trick, too:

Solve[{eq1, eq2}, {K, t}]
 -> {{K -> (a b p)/(c d), t -> -((f p)/(-1 + p))}}