Re: CoefficientList[] option
- To: mathgroup@smc.vnet.net
- Subject: [mg12635] Re: [mg12576] CoefficientList[] option
- From: Daniel Lichtblau <danl@wolfram.com>
- Date: Sat, 30 May 1998 17:36:29 -0400
- References: <199805251824.OAA06186@smc.vnet.net.>
Alex Bates wrote: > > Hello Mathgroup Users, > > I want to print out the Q matrix used the the Berlecamp factorization > algorithm. To generate the Matrix, I was using: > > f[x_] := x^4 + x + 1 // the function I want to factor h[x_] := x^P-x // > P large prime for x^P = x mode f > > Table[CoefficientList[PolynomialMod[h[x^n], {f[x], P}], x], {n, 0, P}] > > say P = 3 > > Then the Table prints out: > > {{}, {0, 2, 0, 2}, {0, 0, 1, 2}, {0, 1, 2}} > > But I want this to be a rectangular matrix (Q) so i can find the > NullSpace and find the irreducible factors (Berlecamp algorithm). > > Is there a way to force CoefficientList[] to pad out its list to P+1 > elements (so that the List it outputs corresponds to a rectangular > matrix?) > In other words, is there an option in CoefficientList[] to print out all > the coefficients up to a certain power of x even if they're zero? > > Thanks, > > Norman Bates No such option. It has been suggested before and we may implement it in some future version. For now you can code it yourself along the lines below. In[8]:= Q1 = Table[CoefficientList[PolynomialMod[h[x^n], {f[x], P}], x], {n, 0, P}]; In[9]:= len = Max[Map[Length,Q1]] Out[9]= 4 In[10]:= zeroPad[vec_,len_] := Table[If[j>Length[vec],0,vec[[j]]],{j,len}] In[11]:= Q2 = Map[zeroPad[#,len]&, Q1] Out[11]= {{0, 0, 0, 0}, {0, 2, 0, 1}, {0, 0, 1, 2}, {0, 1, 2, 0}} Alternatively, why not just use Cantor-Zassenhaus? Daniel Lichtblau Wolfram Research
- References:
- CoefficientList[] option
- From: Alex Bates <norman@galois.uoregon.edu>
- CoefficientList[] option