Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - Русский


bezout

GCD of two polynomials or two integers, by the Bezout method

Syntax

thegcd = bezout(p1,p2)
[thegcd, U] = bezout(p1,p2)

Arguments

p1, p2

two real polynomials or two integer scalars (type equal to 1, 2 or 8)

thegcd

scalar with the type of p1: The Greatest Common Divisor of p1 and p2.

U

2x2 unimodular matrix of the type of p1, such that [p1 p2]*U = [thegcd 0].

Description

thegcd = bezout(p1, p2) computes the GCD thegcd of p1 and p2.

In addition, [thegcd, U] = bezout(p1, p2) computes and returns a (2x2) unimodular matrix U such that [p1 p2]*U = [thegcd 0].

The lcm of p1 and p2 is given by:

p1*U(1,2) (or -p2*U(2,2))

If p1 or p2 are given as doubles (type 1), then they are processed as null degree polynomials.

Examples

// Polynomial case
x = poly(0, 'x');
p1 = (x+1)*(x-3)^5;
p2 = (x-2)*(x-3)^3;
[thegcd,U] = bezout(p1, p2)
det(U)
clean([p1 p2]*U)
thelcm = p1*U(1,2)
lcm([p1 p2])

// With decimal numbers
i1 = 2*3^5;
i2 = 2^3*3^2;
[thegcd,U] = bezout(i1, i2)
V = [2^2*3^5 2^3*3^2 2^2*3^4*5];
[thegcd,U] = gcd(V)
V*U
lcm(V)

// Integer case
i1 = int32(2*3^5);
i2 = int32(2^3*3^2);
[thegcd,U] = bezout(i1, i2)
V = int32([2^2*3^5 2^3*3^2 2^2*3^4*5]);
[thegcd,U] = gcd(V)
V*U
lcm(V)

See also

  • gcd — Greatest (positive) Common Divisor
  • lcm — наименьшее общее кратное (положительное) целых чисел или полиномов
  • diophant — Solves the diophantine (Bezout) equation p1*x1 + p2*x2 = b
  • sylm — Sylvester matrix of two polynomials
  • poly — Определение полинома через указанные корни или коэффициенты или определение характеристического полинома квадратной матрицы.
  • roots — roots of a polynomial
  • simp — rational simplification
  • clean — очищает матрицы (округление малых значений до нуля)

History

ВерсияОписание
6.0.1 The second output U is now optional.
Report an issue
<< Polynomials Polynomials chepol >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 24 11:18:32 CEST 2024