Dr. Wolfgang Lindner on Mon, 13 Apr 2020 18:46:44 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
[PariGP] arithmetic modulo polynomials - best syntax question |
Dear group, testing congruence modulo a polynomial I try to show that: in Z/5Z[X] the polynomials f=1+x+x^2 and g=1-x+3*x^3 are _not_ congruent modulo p=X^2. I like the very straightforward and compact syntax of Pari/GP. So I tried to show the above task on several ways. (Sorry to ask such rudimental questions but I am retired and there is no one else that I could ask.) --------------------------- Here is my CODE: f=1+x+x^2 g=1-x+3*x^3 f5=f*Mod(1,5) g5=g*Mod(1,5) Mod(f5,x^2) Mod(g5,x^2) Mod(f,x^2) Mod(g,x^2) \\ 1. Test Mod(Mod(f,x^2),5) Mod(Mod(g,x^2),5) \\ 2. Test Mod(f,x^2)*Mod(1,5) Mod(g,x^2)*Mod(1,5) \\ 3. per definition (f-g) % x^2 ------------------------- HERE is the ANSWER of PariGP: x^2 + x + 1 3*x^3 - x + 1 Mod(1, 5)*x^2 + Mod(1, 5)*x + Mod(1, 5) Mod(3, 5)*x^3 + Mod(4, 5)*x + Mod(1, 5) Mod(Mod(1, 5)*x + Mod(1, 5), x^2) Mod(Mod(4, 5)*x + Mod(1, 5), x^2) Mod(x + 1, x^2) Mod(-x + 1, x^2) Mod(Mod(1, 5)*x + Mod(1, 5), x^2) Mod(Mod(4, 5)*x + Mod(1, 5), x^2) Mod(Mod(1, 5)*x + Mod(1, 5), x^2) Mod(Mod(4, 5)*x + Mod(1, 5), x^2) Q: - is the test syntax ok? - or are there better suited solutions/formulations in Pari/GP ? Best Wolfgang - - - Dr. Wolfgang Lindner Leichlingen, Germany