Apply a function to a rationalized expression
This functionality does not run in MATLAB.
As a first step,
maprat(object, f, options) calls
options), which generates a rational expression. The
uses the expression returned by
rationalize as an input to the function
As a second step,
maprat replaces all variables
the original subexpressions in
page for details.
Find the greatest common divisor (the
gcd function) for the following two rationalized
expressions. The first argument of
maprat is a
sequence of the two expressions
as two parameters. Note the brackets around the sequence
p := (x - sqrt(2))*(x^2 + sqrt(3)*x - 1): q := (x - sqrt(2))*(x - sqrt(3)): maprat((p, q), gcd)
maprat function accepts the same options
For example, find the least common multiple (the
lcm function) for the following two rationalized
expressions. Use the
FindRelations option to detect
p := tan(x)^2 + 1/cos(x)^2: q := 1/sin(x)^4 + cot(x)^4: maprat((p, q), lcm, FindRelations = ["sin"])
Without this option, the result is:
p := tan(x)^2 + 1/cos(x)^2: q := 1/sin(x)^4 + cot(x)^4: maprat((p, q), lcm)
Free the variables for further calculations:
delete p, q:
Approximate floating-point numbers by rational numbers.
Detect algebraic dependencies for subexpressions of specified types.
If the original expression contains subexpressions, rationalize the specified types of subexpressions.
Replace all subexpressions with limits, sums, and integrals by variables.
Replace all subexpressions of the specified types by variables.
Do not rationalize specified types of subexpressions.
Object returned by the function