Denominator
Denominator
Denominator[ f ] returns the denominator of a fraction.
Usages
Denominator[ f ]
Denominator[ f ] returns the denominator of the fraction f, exactly as it is written. f can be a fraction of numbers, a mixed number or a division of expressions.
| Example | in | out |
|---|---|---|
| A fraction. | Denominator[ 1/2 ] |
2 |
| The fraction is not simplified first. | Denominator[ 2/6 ] |
6 |
| A negative fraction. | Denominator[ -3/4 ] |
4 |
The mixed number -1 2/3. |
Denominator[ Rational[-1,1,2,3] ] |
3 |
| A division of expressions. | Denominator[ (x+1)/(x-1) ] |
x-1 |
| A script variable. | x := 22/7 |
r = 7 |
Warning
For anything that is not written as a fraction or division, Denominator returns 1, without an error. This includes integers, decimal numbers, variables, powers with a negative exponent and lists: Denominator[ 0.5 ], Denominator[ x^(-1) ] and Denominator[ {1/2, 1/3} ] all return 1. Use DecimalToFraction to convert a decimal number first, and Map for a list.
See also: Numerator, DecimalToFraction, Map