<< gf_poly_power Polynomials over GF(p) Operation tables >>

Galois Fields >> Galois Fields > Polynomials over GF(p) > gf_poly_subtract

gf_poly_subtract

Subtracts polynomials over GF(p)

Syntax

c = gf_poly_subtract(a, b, p)

Arguments

a, b

Polynomial over GF(p): a row vector of integer coefficients in 0 .. p-1, constant term first. For instance [1 0 1 1] is 1 + x² + x³. The two polynomials can have different lengths.

p

Prime number: the characteristic of the field.

c

Result as a row of coefficients, constant term first, trimmed to its degree (no trailing zeros). The zero polynomial is returned as 0.

Description

gf_poly_subtract(a, b, p) computes a - b, subtracting coefficients of equal degree modulo p.

Examples

gf_poly_subtract([1 2], [0 0 1], 3)   // [1 2 2]: (1 + 2x) - x^2 = 1 + 2x + 2x^2

See also

History

VersionDescription
2.0.0

Refactoring of the function/toolbox. Operands of different lengths are accepted and the result is trimmed.


Report an issue
<< gf_poly_power Polynomials over GF(p) Operation tables >>