private void InvertF3() { IntegerPolynomial a = new IntegerPolynomial(new int[] { -1, 1, 1, 0, -1, 0, 1, 0, 0, 1, -1 }); IntegerPolynomial b = a.InvertF3(); AssertEqualsMod(new int[] { 1, 2, 0, 2, 2, 1, 0, 2, 1, 2, 0 }, b.Coeffs, 3); VerifyInverse(a, b, 3); // test a non-invertible polynomial a = new IntegerPolynomial(new int[] { 0, 1, -1, 1, 0, 0, 0, 0, -1, 0, 0 }); b = a.InvertF3(); if (b != null) throw new Exception("IntegerPolynomialTest InvertF3 test failed!"); }