![]() |
polynomial calculations over Z/Zp (for prime p)? - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: polynomial calculations over Z/Zp (for prime p)? (/thread-221.html) |
polynomial calculations over Z/Zp (for prime p)? - Jeff Nye - 12-24-2013 04:00 AM Hi, Does the Prime have some way to compute with polynomials whose coefficients are in Z/pZ (for prime p)? If so, I'd be grateful for an example. thank you, Jeff RE: polynomial calculations over Z/Zp (for prime p)? - Han - 12-24-2013 04:09 AM You have several ways of implementing \( \mathbb{Z}/\mathbb{Z}_p[x]\). You can use vectors (of coefficients), actual symbolic expressions, or the "poly" type: Code:
RE: polynomial calculations over Z/Zp (for prime p)? - Alberto Candel - 12-24-2013 07:04 AM Hi, What are the CAS settings for this to work? For example, quo() is documented in the xcas manual (2.25.3), but I cannot get it to work in the HP prime: quo( (x^3+3x)%5,(2x^2+6x-5)%5) should output -2x+1 but I get an error. Same if % is replaced by MOD (or mod). In fact, the HP prime example in the Help for MOD is 9 mod 5 results in an error. Maybe my CAS settings are wrong. RE: polynomial calculations over Z/Zp (for prime p)? - Jeff Nye - 12-24-2013 11:56 AM (12-24-2013 04:09 AM)Han Wrote: These didn't work for me (using the latest firmware). However, last night I stumbled upon the CAS %%(n,p) operator, which seems to be the % operator in xcas. With %% instead of %, example p1 worked fine. Example p2 produces a polynomial with non-modular coefficients. For example p3, I needed to say poly([ 12 13 -20 5 ] %% p). Linear algebra seems to work with integers mod p. The expression [[4,3],[5,1]]%%3 defines a matrix of integers mod 3. RE: polynomial calculations over Z/Zp (for prime p)? - Alberto Candel - 12-24-2013 03:39 PM Yes, %% does the job. The single % is for percentage in the Prime. Very convoluted notation thou. RE: polynomial calculations over Z/Zp (for prime p)? - Han - 12-24-2013 03:49 PM (12-24-2013 11:56 AM)Jeff Nye Wrote:(12-24-2013 04:09 AM)Han Wrote: Thank you for the corrections RE: polynomial calculations over Z/Zp (for prime p)? - Alberto Candel - 12-24-2013 04:10 PM I wonder if one has a choice of residue system used. The %% uses the minimal residue system mod n. Is there a way to display results using the common (or least) residue system mod n (that is, {0,1,...,n-1})? The negative signs combined with the double %% make the results rather cumbersome to read. RE: polynomial calculations over Z/Zp (for prime p)? - parisse - 12-25-2013 07:55 AM You can remove the %% by the %% 0 command, then run irem on each coefficient. |