Main Content

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

collapse all

Display statements about randomly selected elements of GF(81).

Use the gfprimfd function to find the primitive polynomials for GF(81).

p = 3; 
m = 4;
primpolys = gfprimfd(m,'all',p);
[rows, cols] = size(primpolys);

Randomly select a primitive polynomial by selecting a row jj from primpolys, and then display the jjth primitive polynomial in the traditional format by using the gfpretty function.

jj = randi([1,rows]);
gfpretty(primpolys(jj,:))
 
                                     2      3    4
                            2 + X + X  + 2 X  + X 

For the root A of the primitive polynomial primpoly(jj,:), a randomly selected element A^ii from GF(81) can be displayed in traditional format by using the gfpretty function.

ii = randi([1,p^m-2]);
gfpretty([zeros(1,ii),1],'A')
 
                                       72
                                      A  

The element A^ii can be expressed as shown here by using the gfpretty and gftuple functions.

gfpretty(gftuple(ii,m,p),'A')
 
                                      2      3
                                 1 + A  + 2 A 

Version History

Introduced before R2006a

See Also

|