[Maxima] gcd strangeness
robert.dodier at gmail.com
Mon Mar 13 22:45:21 CST 2006
One of the simplifications of mod(x, y) first computes gcd(x, y).
However gcd yields some results I didn't expect.
e.g. gcd (x, y/2); => 1/2, gcd (x, y/a); => 1/a, gcd (x - 1/2, %e); => 1/2
I expected 1 in these cases. What is the interpretation of gcd
in which these make sense? Thanks for any insights.
PS. If anyone has some remarks which clarify this description of gcd,
I will update the texinfo file. In particular, what are the various algorithms,
and why would one be chosen over another.
-- Function: gcd (<p_1>, <p_2>, <x_1>, ...)
Returns the greatest common divisor of <p_1> and <p_2>. The flag
`gcd' determines which algorithm is employed. Setting `gcd' to
`ez', `eez', `subres', `red', or `spmod' selects the `ezgcd', New
`eez' `gcd', subresultant `prs', reduced, or modular algorithm,
respectively. If `gcd' `false' then GCD(p1,p2,var) will always
return 1 for all var. Many functions (e.g. `ratsimp', `factor',
etc.) cause gcd's to be taken implicitly. For homogeneous
polynomials it is recommended that `gcd' equal to `subres' be
used. To take the gcd when an algebraic is present, e.g.
GCD(X^2-2*SQRT(2)*X+2,X-SQRT(2)); , `algebraic' must be `true' and
`gcd' must not be `ez'. `subres' is a new algorithm, and people
who have been using the `red' setting should probably change it to
The `gcd' flag, default: `subres', if `false' will also prevent
the greatest common divisor from being taken when expressions are
converted to canonical rational expression (CRE) form. This will
sometimes speed the calculation if gcds are not required.
More information about the Maxima