Numerator
Numerator
Numerator[ f ] returns the numerator of a fraction.
Usages
Numerator[ f ]
Numerator[ f ] returns the numerator of the fraction f, exactly as it is written. f can be a fraction of numbers, a mixed number or a division of expressions. A mixed number is first written as one fraction.
| Example | in | out |
|---|---|---|
| A fraction. | Numerator[ 2/3 ] |
2 |
| The fraction is not simplified first. | x := 2/6 |
r = 2 |
| A negative fraction. | Numerator[ -3/4 ] |
-3 |
The mixed number 2 3/4 = 11/4. |
Numerator[ Rational[1,2,3,4] ] |
11 |
The mixed number -2 3/4 = -11/4. |
Numerator[ Rational[-1,2,3,4] ] |
-11 |
| A division of expressions. | Numerator[ (x+1)/(x-1) ] |
x+1 |
Numerator[ list ]
If the argument is a list, the numerator of each element is returned.
| Example | in | out |
|---|---|---|
| The numerators of two fractions. | Numerator[ {1/2, 3/4} ] |
{1, 3} |
Details
- Not a fraction: anything that is not written as a fraction or division is returned unchanged:
Numerator[ 5 ]gives5,Numerator[ 0.5 ]gives0.5andNumerator[ x^(-1) ]givesx^(-1). UseDecimalToFractionto convert a decimal number first.
See also: Denominator, DecimalToFraction