Name:

gcd Computes the greatest common divisor of polynomials or numbers.

Library name:

sollya_obj_t sollya_lib_gcd(sollya_obj_t, sollya_obj_t)

Usage:

gcd(p, q) : (function, function) -> function

Parameters:

Description:

Example 1:

   > gcd(1001, 231);
   77
   > gcd(13, 17);
   1
   > gcd(-210, 462);
   42

Example 2:

   > rationalmode = on!;
   > gcd(6/7, 33/13);
   3 / 91

Example 3:

   > gcd(exp(13),sin(17));
   1

Example 4:

   > gcd(24 + 68 * x + 74 * x^2 + 39 * x^3 + 10 * x^4 + x^5, 480 + 776 * x + 476 * x^2 + 138 * x^3 + 19 * x^4 + x^5);
   4 + x * (4 + x)
   > gcd(1001 * x^2, 231 * x);
   x * 77

Example 5:

   > gcd(exp(x), x^2);
   1
See also: div, mod, numberroots
Go back to the list of commands