This is probably a pretty stupid question--but I can't seem to find a relevant explanation in the pari-gp literature. I'm looking for a function in the library that takes a polynomial, or a series, or a constant, and spits out the constant portion (in the constant case, it'll just spit out the input).
The tool I've been using is polcoef(Expression,0)
but this doesn't work for multiple variables--we have to call the function again.
For example,
polcoef(1+z+z^2,0)
%2 = 1
polcoef(1+y+z,0)
%3 = z + 1
polcoef(polcoef(1+y+z,0),0)
%4 = 1
Is there a built in function that'll do this for an arbitrary number of variables? So that, I don't have to iterate the polcoef
function. This would clean up my code considerably; and I know I could probably build a recursive function myself, but I'm wondering if there's something built-in that does this.
Any help, comments, requests to edit and clarify are greatly appreciated.
Regards.
Edit:
Forgot to add, my desired output is,
Const(1+x+y+z)
1
Const(Pi+x^2+p)
Pi