Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - English


pdiv

polynomial division

Syntax

[R, Q] = pdiv(P1,P2)
Q = pdiv(P1,P2)

Arguments

P1, R, Q

arrays of polynomials with real or complex coefficients, of same sizes. Q are Quotients and R are Remainders.

When all remainders R are constant (degree==0), R is of type 1 (numbers) instead of 2 (polynomials).

P2

single polynomial, or array of polynomials of size(P1).

Description

Element-wise euclidan division of the polynomial array P1 (scalar, vector, matrix or hypermatrix) by the polynomial P2 or by the polynomial array P2. R is the array of remainders, Q is the array of quotients, such that P1 = Q*P2 + R or P1 = Q.*P2 + R.

Examples

x = poly(0,'x');
//
p1 = (1+x^2)*(1-x);
p2 = 1-x;
[r,q] = pdiv(p1, p2)
p2*q-p1

// With polynomials with complex coefficients
p1 = (x-%i)*(x+2*%i);    printf("%s\n",string(p1))
p2 = 1-x;
[r, q] = pdiv(p1, p2);   printf("%s\n", string([r;q]))
p = q*p2 + r;            printf("%s\n", string(p)); // p1 expected

// Elementwise processing:
p1 = [1+x-x^2 , x^3-x+1];
p2 = [2-x , x^2-3];
[r,q] = pdiv(p1, p2)

See also

  • ldiv — polynomial matrix long division
  • pfss — partial fraction decomposition
  • gcd — Greatest (positive) Common Divisor
VersionDescription
6.0.0 pdiv now returns a matrix of type 'constant' when all degrees are 0.
6.0.2 Extension to hypermatrices.
Report an issue
<< ldiv Polynomials pol2str >>

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:13:09 CEST 2024