How do i substitute a value into a polynomial in Magma (CAS)?

1.1k Views Asked by At

I have the following code

R := PolynomialRing( Integers() ); i:=2^6-1; a:=Intseq(i,2);
f:=Polynomial(a);
f; //resulting in X^5 + X^4 + X^3 + X^2 + X + 1

I would like to replace the terms of the polynomial X with an integer, let's say 3 or 4? I tried these:

f1 := f where X is 3; f1; Result(f,3); R := PolynomialRing(f,3);

none of which are giving the desired integer result.

1

There are 1 best solutions below

1
On

If I understand you correctly, what you want is the evaluation of the polynomial at the given values. Thus:

Evaluate(f, 3);