Group Abstract Group Abstract

Message Boards Message Boards

0
|
8.6K Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Hold a fraction in unreduced terms?

This is trivial but for the life of me I cannot find a reference in the docs and it has perplexed me forever. Either I have forgotten, not unlikely & more common as I grow longer of tooth, or I never knew. I unsuccessfully searched the forum for unreduced _ and fraction_

How can I hold a fraction in unreduced terms Mathematica. For instance how can I get the example to display as: {4/18, 6/18, 8/18}

    r = {2, 3, 4};
    r/Total[r]
    HoldForm[r/Total[r]]

    {2/9, 1/3, 4/9}

r={2,3,4};
r/Total[r]
HoldForm[r/Total[r]]
{2/9,1/3,4/9}
r/Total[r]

HoldForm[] clearly is not the answer.

Attachments:
POSTED BY: Roger M Kolaks
4 Replies
POSTED BY: Roger M Kolaks

Try that

In[70]:= Clear[r]
         r = {2, 3, 4};
         (r /. x_Integer -> If[Divisible[Total[r], x], Hold[x], x])/Total[r]
Out[72]= {2/9, Hold[3]/9, 4/9}
POSTED BY: Udo Krause
POSTED BY: Roger M Kolaks
POSTED BY: S M Blinder
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard