Function reference · Algebra
gcd
Returns the greatest common divisor of two polynomials or numbers.
It finds common numeric factors, monomials, and polynomial factors in one or more variables, including factors with symbolic coefficients.
Notation
gcd(x, y)
Write it in an expression: nerdamer('gcd(6*(x-1)*(x+2),15*(x-1)*(x^3+1))'), or in the Playground.
nerdamer.gcd
nerdamer.gcd(x: ExpressionInput, y: ExpressionInput): Expression
A method on the default import. Arguments can be strings, as in Notation.
import { gcd }
import { gcd } from 'nerdamer/algebra';
gcd(x: ExpressionInput, y: ExpressionInput): Expression
Import only this function, from nerdamer/algebra.
Examples
A common number and polynomial factor.
gcd(6*(x-1)*(x+2),15*(x-1)*(x^3+1))
// → -3+3*xOpen in PlaygroundA common factor with symbolic coefficients.
gcd((x^2+a)*(x^3+1),(x^2+a)*(x^4+b*x+1))
// → a+x^2Open in Playground