2
$\begingroup$

How do I force mathematica to display the below expression as a sum a+b with a scaling factor of 1/r.

(a+b)/r

I would like Mathematica to display (1/r) (a+b), ie. I want it to show 1/r as a scaling factor.

currently, it shows (a+b)/r , with r as a common denominator.

$\endgroup$
  • $\begingroup$ Have you tried anything ? Any code you would like to share ? $\endgroup$ – Sektor Mar 7 '15 at 12:19
  • $\begingroup$ ((a+b)/r)[[2]] ? $\endgroup$ – Algohi Mar 7 '15 at 12:25
  • 1
    $\begingroup$ Algohi, try ((2 + x)/7)[[2]] $\endgroup$ – DavidC Mar 7 '15 at 13:53
  • $\begingroup$ Coefficient[(a + b)/r, a + b]? $\endgroup$ – kglr Mar 7 '15 at 15:29
  • $\begingroup$ @DavidCarraher In this case use Hold[((2 + x)/7)][[1, 2]] $\endgroup$ – Algohi Mar 7 '15 at 18:26
3
$\begingroup$

Here is something close to what you want

expr = (a + b)/r;
expr Denominator[expr] HoldForm[1/Denominator[expr] // Evaluate]

output

$\endgroup$
0
$\begingroup$
expr = (a + b)/r
1/Denominator[expr]

Mathematica graphics

$\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.