0

Define the coefficient $B = (b_0, \cdots b_n)$ of elementarty polynomial product of $A=(a_0 \cdots, a_n)$. $B = \sum_{i=0}^N b_ix^i = \prod_{i=0}^N(1+a_ix) $. Use $f(A) = B$ to get it's coefficient.

Given a length $n$ sequence $A$, i need to compute $g(A) := \frac{1}{n+1}\langle f(A), 1/f(1_n)\rangle$. Here $1_n$ denote length $n$, 1 sequence. $1/f(1_n)$ is the element-wise reciprocal. and $\langle, \rangle$ is the inner product.

My question is: is it possible to factor $g(A)$? E.g. compute some quantity using the first half of $A$ and the second half of $A$ independently and then join them together.

The reason why I want to do this is when $n$ is big, I can easily run into a precision problem. My code would overflow :(.

peng yu
  • 1,271
  • The constant coefficient of $\prod_{i=1}^n (1+a_i x)$ is $1$, but there is no requirement that $b_0 = 1$. So almost always, $f$ doesn't exist. – Eric Towers Jan 03 '22 at 23:42
  • sorry, I missed the leading $0$ term, $f$ is not some fancy function, but simply multiply a bunch of low degree polynomials @EricTowers – peng yu Jan 04 '22 at 00:36
  • Does not correct the omission. Try it with $B = (2)$. There is no $A$ that gives this $B$. – Eric Towers Jan 04 '22 at 08:10

1 Answers1

1

(Too long for a comment.)

Then $\displaystyle\,(n+1)\,g(A) = \langle f(A), 1/f(1_n)\rangle = \sum_{i=0}^n \frac{b_i}{c_i}\,$ where $\,b_i, \,c_i\,$ can be calculated as above.

dxiv
  • 76,497
  • Thank you for the links, just want to highlight the aspect I was looking for is about overflow issues, as I might have $N=50$ and $a_n ~ 1e5$, such that the polynomial coefficient can be too big – peng yu Jan 04 '22 at 04:33
  • @pengyu Calculating $b_i,c_i$ recursively lessens the chance of "avoidable" overflows in general, because (in a sense) it takes the most direct path of evaluation. But if the end result does not fit into the types you are using, then you have an "unavoidable" overflow on your hands, which you are going to hit no matter how clever the intermediate calculations. – dxiv Jan 04 '22 at 04:40
  • Yes and no.. as $b_i, c_i$ cancels each other, and the aggregated result is known stable, if I can figure out a way to aggregate in low degree and recombine, it would have less chance to overflow – peng yu Jan 04 '22 at 04:43
  • @pengyu You could probably "merge" the recursions for $b_i, c_i$ into a combined recursion for the ratio $b_i / c_i$. As to whether anything "cancels each other", that depends on particulars of the problem, which you did not post. If you have additional knowledge about the $,a_i,$ then you should edit that into the question, since it could help better "tune" the answers. – dxiv Jan 04 '22 at 04:47