Ask Your Question

BurnsBA's profile - activity

2023-10-03 14:32:38 +0100 received badge  Famous Question (source)
2023-10-03 14:32:38 +0100 received badge  Notable Question (source)
2022-04-08 10:23:41 +0100 received badge  Popular Question (source)
2020-11-19 03:17:42 +0100 received badge  Supporter (source)
2020-11-18 10:11:10 +0100 received badge  Student (source)
2020-11-18 10:02:46 +0100 asked a question Apply modulus to polynomial coefficients

I want to apply mod operator to a polynomial and get the expanded result. For example

$$ (x+1)^4 \bmod 6 $$ should give $$ x^4 + 4 x^3 + 4 x + 1 $$

What I've tried:

sage: ZP.<x> = ZZ[]
sage: ( (x+1)^4 ).factor_mod(6)
ValueError: p must be prime

sage: Mod( (x+1)^4 , 6)
TypeError: not a constant polynomial

and

a,b,c=var('a,b,c')
sage: ((a+b+c)^3).expand()
a^3 + 3*a^2*b + 3*a*b^2 + b^3 + 3*a^2*c + 6*a*b*c + 3*b^2*c + 3*a*c^2 + 3*b*c^2 + c^3
sage: (a+b+c)^3 % 3
TypeError: unsupported operand parent(s) for %: 'Symbolic Ring' and 'Symbolic Ring'