Function Repository Resource:

MixedNumberForm

Source Notebook

Represent an improper fraction in mixed form

Contributed by: Igor Bakshee

ResourceFunction["MixedNumberForm"][expr]

prints all improper fractions in expr as mixed numbers.

Details and Options

ResourceFunction["MixedNumberForm"] acts as a wrapper, which affects printing but not evaluation.
Typeset numbers in ResourceFunction["MixedNumberForm"][p/q] can be used directly for input to the Wolfram Language.

Examples

Basic Examples (1) 

Represent an improper fraction as a mixed number:

In[1]:=
ResourceFunction["MixedNumberForm"][3/2]
Out[10]=
In[11]:=
ResourceFunction["MixedNumberForm"][10/3]
Out[25]=

Scope (1) 

Print all improper fractions in expressions as mixed numbers:

In[26]:=
(f[3/2] + g[7/5]) // ResourceFunction["MixedNumberForm"]
Out[27]=

Applications (1) 

Print a cooking recipe:

In[28]:=
StringForm["Add `` spoons of sugar.", ResourceFunction["MixedNumberForm"][3/2]]
Out[28]=

Properties and Relations (3) 

The MixedNumberForm wrapper disappears on evaluation:

In[29]:=
ResourceFunction["MixedNumberForm"][3/2]
Out[30]=
In[31]:=
%
Out[31]=

Expressions in MixedNumberForm allow copying and pasting in input cells:

In[32]:=
1 + 1 
If[ToExpression["1"] >= 0, "+", "-"] 1/2
Out[32]=

Expressions in MixedNumberForm can be edited:

In[33]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/85f811bc-07c9-4761-b6a7-5d405079a2bb"]
Out[33]=

Version History

  • 1.0.0 – 27 September 2019

Related Resources

License Information