numer -- the numerator of a
rational expression
Introductionnumer(f) returns the numerator of the
expression f.
Call(s)numer(f)
Parametersf |
- | an arithmetical expression |
Returnsan arithmetical expression.
f
Related
Functions
Detailsnumer regards the input as a rational expression: non-rational subexpressions
such as sin(x), x^(1/2) etc. are internally
replaced by ``temporary variables''. The numerator of this rationalized
expression is computed, the temporary variables are finally replaced by
the original subexpressions.Numerator and denominator are not necessarily
cancelled: the numerator returned by numer may have a
non-trivial gcd with the
denominator returned by denom. Preprocess the expression by
normal to enforce
cancellation of common factors. Cf. example 2.
Example
1We compute the numerators of some expressions:
>> numer(-3/4)
-3
>> numer(x + 1/(2/3*x -2/x))
3
2 x - 3 x
>> numer((cos(x)^2 -1)/(cos(x) -1))
2
cos(x) - 1
Example
2numer performs no cancellations if the
rational expression is of the form ``numerator/denominator'':
>> r := (x^2 - 1)/(x^3 - x^2 + x - 1): numer(r)
2
x - 1
This numerator has a common factor with the denominator
of r; normal enforces cancellation of
common factors:
>> numer(normal(r))
x + 1
However, automatic normalization occurs if the input expression is a sum:
>> numer(r + x/(x + 1) + 1/(x + 1) - 1)
x + 1
>> delete r: