Up | Next | Prev | PrevTail | Tail |
Greatest common divisor calculations can often become expensive if extensive work with
large rational expressions is required. However, in many cases, the only significant
cancellations arise from the fact that there are often common factors in the various
denominators which are combined when two rationals are added. Since these
denominators tend to be smaller and more regular in structure than the numerators,
considerable savings in both time and space can occur if a full GCD check is made when
the denominators are combined and only a partial check when numerators are
constructed. In other words, the true least common multiple of the denominators is
computed at each step. The switch lcm
is available for this purpose, and is normally
on.
In addition, the operator lcm
, used with the syntax
lcm(exprn1:polynomial,exprn2:polynomial):polynomial,
returns the least common multiple of the two polynomials exprn1
and exprn2
.
Examples:
lcm(x^2+2*x+1,x^2+3*x+2) -> x**3 + 4*x**2 + 5*x + 2 lcm(2*x^2-2*y^2,4*x+4*y) -> 4*(x**2 - y**2)
Up | Next | Prev | PrevTail | Front |