gfpretty

Polynomial in traditional format

Syntax

gfpretty(a)
gfpretty(a,st)
gfpretty(a,st,n)

Description

gfpretty(a) displays a polynomial in a traditional format, using X as the variable and the entries of the row vector a as the coefficients in order of ascending powers. The polynomial is displayed in order of ascending powers. Terms having a zero coefficient are not displayed.

gfpretty(a,st) is the same as the first syntax listed, except that the content of st is used as the variable instead of X.

gfpretty(a,st,n) is the same as the first syntax listed, except that the content of st is used as the variable instead of X, and each line of the display has width n instead of the default value of 79.

Note

For all syntaxes: If you do not use a fixed-width font, the spacing in the display might not look correct.

Examples

Display statements about the elements of GF(81).

p = 3; m = 4;
ii = randi([1,p^m-2],1,1); % Random exponent for prim element
primpolys = gfprimfd(m,'all',p);
[rows, cols] = size(primpolys);
jj = randi([1,rows],1,1); % Random primitive polynomial

disp('If A is a root of the primitive polynomial')
gfpretty(primpolys(jj,:)) % Polynomial in X
disp('then the element')
gfpretty([zeros(1,ii),1],'A') % The polynomial A^ii
disp('can also be expressed as')
gfpretty(gftuple(ii,m,p),'A') % Polynomial in A

Below is a sample of the output.

If A is a root of the primitive polynomial
 
                                        3    4
                                 2 + 2 X  + X 
then the element
 
                                       22
                                      A  
can also be expressed as
 
                                       2    3
                                  2 + A  + A 

See Also

|

Introduced before R2006a