| ||||||||||||||||||
Rational Expressions
A rational expression is the quotient of two polynomials.
Examples:
(2 + x)/(3 + y) is the polynomial 2 + x divided by the polynomial 3 + y.
1/x + 1/y is not a rational expression, but it can be transformed
into (x + y)/(x * y) which is a rational expression. Notice that the latter expression will be
displayed as (x + y)/x/y.
numerator(expr) and denominator(expr)
These two functions extract the numerator and denominator of an expression.
Examples:
numerator(a/(b + c)) returns a
denominator(a/(b + c)) returns b + c
numerator(1/x + 1/y) returns 1/x + 1/y
denominator(1/x + 1/y) returns 1
numerator((x + y)/x/y) returns x + y
denominator((x + y)/x/y) returns x * y
rational(expr)
This function converts an expression into a rational expression, but does not simplify the result.
Examples:
rational(1/x + 1/y) returns (x + y)/x/y
rational(1/x^2 + 1/(x*y)) returns (x^2 + x * y)/x^3/y
ratsimp(expr)
This function applies rational to an expression, and then tries to simplify the result as much as possible by removing factors that are common to both numerator and denominator.
Examples:
ratsimp(1/x + 1/y) returns (x + y)/x/y
ratsimp(1/x^2 + 1/(x*y)) returns (x + y)/x^2/y
ratsimp((x^2/(4-x^2)^(3/2) + 1/(4-x^2)^(1/2)) / (1 + x^2/(4-x^2))^(3/2)) returns 1/2
