galois.Poly.__eq__(other: PolyLike) bool

Determines if two polynomials are equal.

Parameters:
other: PolyLike

The polynomial to compare against.

Returns:

`True` if the two polynomials have the same coefficients and are over the same finite field.

Examples

Compare two polynomials over the same field.

``````In : a = galois.Poly([3, 0, 5], field=galois.GF(7)); a
Out: Poly(3x^2 + 5, GF(7))

In : b = galois.Poly([3, 0, 5], field=galois.GF(7)); b
Out: Poly(3x^2 + 5, GF(7))

In : a == b
Out: True

# They are still two distinct objects, however
In : a is b
Out: False
``````

Compare two polynomials with the same coefficients but over different fields.

``````In : a = galois.Poly([3, 0, 5], field=galois.GF(7)); a
Out: Poly(3x^2 + 5, GF(7))

In : b = galois.Poly([3, 0, 5], field=galois.GF(7**2)); b
Out: Poly(3x^2 + 5, GF(7^2))

In : a == b
Out: False
``````

Comparison with `PolyLike` objects is allowed for convenience.

``````In : GF = galois.GF(7)

In : a = galois.Poly([3, 0, 2], field=GF); a
Out: Poly(3x^2 + 2, GF(7))

In : a == GF([3, 0, 2])
Out: True

In : a == [3, 0, 2]
Out: True

In : a == "3x^2 + 2"
Out: True

In : a == 3*7**2 + 2
Out: True
``````