4
$\begingroup$

I have a quite simple question. I have an expression that looks similar to $T=\frac{1}{a_1}-\frac{1}{a_2}+1$ and I'd like Mathematica to use $A=\frac{a_1}{a_2}$ to reformat the expression (if possible) such that only $A$ appears in it.

Any idea?

Cheers, Pascal

$\endgroup$
3
  • $\begingroup$ Does this help: mathematica.stackexchange.com/q/894/131 ? $\endgroup$
    – Yves Klett
    Feb 6 '13 at 12:13
  • $\begingroup$ Sorry, but no. The example used in the mentioned thread is way to elaborate for me to understand. $\endgroup$
    – Pascal
    Feb 6 '13 at 13:13
  • 5
    $\begingroup$ If you could transform your expression in something depending on A only that would mean that the original expression would not change if I'd multiply both a1 and a2 with the same constant (A = a1/a2 = (c a1)/(c a2) ). Clearly, making that change to the original variables does change T. So, the transformation you want isn't possible. $\endgroup$ Feb 6 '13 at 13:31
2
$\begingroup$

Here is your expression and a rule for replacement:

T = 1/a1 - 1/a2;
rule = a1 -> A*a2;

Let us replace:

T /. rule

You get this:

-(1/a2) + 1/(A a2)

You may further transform it. For example:

% // Factor

The result is:

-((-1 + A)/(A a2))

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.