Karim Belabas on Tue, 28 Aug 2007 10:17:35 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: polsym() reverse |
* Max Alekseyev [2007-08-15 03:24]: > Does there exist a function that is reverse to polsym(), i.e., that > reconstructs the polynomial from given vector of the symmetric powers > of its roots? I don't think there's a public one ( there are at least 3 private ones buried in various code modules ). > I believe that such function should exist but I could not find it so far. > > If not, does anybody have an implementation of such a function? Here's one: PolFromPowerSums(S) = { local( n = S[1], a = vector(n+1) ); a[1] = 1; for (k = 2, n, a[k+1] = sum(i = 1, k, S[i+1]*a[k+1-i]) / -k); Pol(a) } 1) is defined up to a multiplicative constant, so assumes the result is monic. 2) assumes the base ring has characteristic 0 or > n. 3) assumes #S >= Degree(Pol), otherwise we do not have enough information. Should trigger a nice error message if #S <= S[1]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I can add a trivial GP function implementing the above. How should I name it ? The above doesn't quite fit our current naming scheme:-) 'polsym' was not a great choice; 'powersums' would have been clearer/easier to find. When I read 'polsym', I think about symmetric functions of the roots, hence about the opposite construction ... Cheers, K.B. -- Karim Belabas Tel: (+33) (0)5 40 00 26 17 Universite Bordeaux 1 Fax: (+33) (0)5 40 00 69 50 351, cours de la Liberation http://www.math.u-bordeaux.fr/~belabas/ F-33405 Talence (France) http://pari.math.u-bordeaux.fr/ [PARI/GP] `