> < ^ From:

^ Subject:

Dear Gap-Forum,

Ming Chan wrote:

- is there a way to convert from a polynomial to vector? The Polynomial

in Chap. 19 converts vector to poly, but I can't find a command to go

the other way.

In GAP3 (which I assume you use), the command

ShiftedCoeffs(f.coefficients,f.valuation)

returns the coefficient list of f. (The shifting is necessary because we

store the coefficient list in a more compact form without leading zeroes.)

(In GAP4 the commands would be:

c:=CoefficientsOfLaurentPolynomial(f);

ShiftedCoefficients(c[1],c[2]); )

- do I refer to an individual element in a vector just the same as I do

in Pascal or C? (eg. vec[0] or vec[1]?)

List access is via the square brackets. However there is no index 0 and

contrary to pascal lists can change their length by adding to them.

The manual chapter on lists explains more details.

- is it possible to do interactive inputs? For example, I want to

display:

In GAP3 this is impossible. (In GAP4 you can acchieve this using streams,

but it is a little bit complicated. You can find example code in the library

file `help.g'.)

- I defined a variable by using:

alpha = Z(256)^1;which means that alpha is first non-zero Galois field element in

GF(256). From now if I want to a power of alpha I just go alpha^2.

Is it possible to display the name of this variable as "alpha" as well?

Currently the output is displayed as "Z(2^8)^26" or similar, which

reduces readability. I tried using:alpha.name := "alpha";

You cannot change the printing of the built-in finite field elements.

In principle you could acchieve such a result by constructing a field with

256 elements yourself using the command `AlgebraicExtension' (see the manual

for details). Hoever for GAP this field would be different from GF(256) and

it is likely that not all functions will work for these fields. (For example

in GAP3, you cannot multiply matrices over such a field.)

Best regards,

Alexander Hulpke

> < [top]