Last active
June 2, 2016 22:04
-
-
Save artemjackson/e3d6bc24da1b40354b7de0329e86374a to your computer and use it in GitHub Desktop.
inverse polynomial in GF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* обратный в поле полином *) | |
PolynomialBase = x^8 + x^4 + x^3 + x + 1; | |
NumericBase = 2; | |
InversePolynomial[p_] := Block[{result, polynomial = p, i, d, a, b}, | |
{d, {a, b}} = PolynomialExtendedGCD[polynomial, PolynomialBase, x, Modulus -> NumericBase]; | |
Return[PolynomialMod[a, NumericBase]]; | |
]; | |
InversePolynomial[x^2 + 1] | |
(* x + x^4 + x^6 *) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment