Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Change language to: English - Français - Português - 日本語 -
Справка Scilab >> Polynomials > pdiv

# 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)```

• ldiv — polynomial matrix long division
• pfss — partial fraction decomposition
• gcd — Greatest (positive) Common Divisor
 Версия Описание 6.0.0 pdiv now returns a matrix of type 'constant' when all degrees are 0. 6.0.2 Extension to hypermatrices.