I'm trying to get a vector of polynomials, but within the vector have each polynomial defined by a function in Pari.
For example, I want to be able to output a vector of this form:
[f(x) = x-1 , f(x) = x^2 - 1, f(x) = x^3 - 1, f(x) = x^4 - 1, f(x) = x^5 - 1]
A simple vector construction of vector( 5, n, f(x) = x^n-1)
doesn't work, outputting [(x)->my(i=1);x^i-1, (x)->my(i=2);x^i-1, (x)->my(i=3);x^i-1, (x)->my(i=4);x^i-1, (x)->my(i=5);x^i-1]
.
Is there a way of doing this quite neatly?
Update:
I have a function which takes a polynomial in two variables (say x and y), replaces one of those variables (say y) with exp(I*t), and then integrates this between t=0 and t=1, giving a single variable polynomial in x: int(T)=intnum(t=0,1,T(x,exp(I*t)))
Because of the way this is defined, I have to explicitly define a polynomial T(x,y)=...
, and then calculate int(T)
. Simply putting in a polynomial, say int(x*y)-1
, returns:
*** at top-level: int(x*y-1)
*** ^----------
*** in function int: intnum(t=0,1,T(x,exp(I*t)))
*** ^--------------
*** not a function in function call
*** Break loop: type 'break' to go back to GP prompt
I want to be able to do this for many polynomials, without having to manually type T(x,y)=...
for every single one. My plan is to try and do this using the apply
feature (so, putting all the polynomials in a vector - for a simple example, vector(5, n, x^n*y-1)
). However, because of the way I've defined int
, I would need to have each entry in the vector defined as T(x,y)=...
, which is where my original question spawned from.
Defining T(x,y)=vector(5, n, x^n*y-1)
doesn't seem to help with what I want to calculate. And because of how int
is defined, I can't think of any other way to go about trying to tackle this.
Any ideas?