Mathematica 9 is now available
 Documentation / Mathematica / Built-in Functions / Numerical Computation / Number Representation  /
Rational

  • Rational is the head used for rational numbers.
  • You can enter a rational number in the form n / m.
  • The pattern object _Rational can be used to stand for a rational number. It cannot stand for a single integer.
  • You have to use Numerator and Denominator to extract parts of Rational numbers.
  • See the Mathematica book: Section 3.1.1.
  • See also: Integer, Numerator, Denominator.

    Further Examples

    Fractions are represented internally without either a fraction bar or the slash character.

    In[1]:=

    Out[1]=

    Therefore the first pattern won't work to identify a fraction.

    In[2]:=

    Out[2]=



    Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
    THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
    SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.