3
$\begingroup$

I've seen several questions here concerning precision issues when performing multiple floating point calculations, but unfortunately got completely confused. I really don't understand what precision means. Actually I don't even understand difference between accuracy and precision in Mathematica. And I badly need this understanding. I really hope somebody can explain all this to me, or point to an answer to a question where it is clearly written.

I thought maybe I would understand better if explained on my own example where I want to achieve precise result and cannot.

So, I need to compute some expressions involving $n$th elementary symmetric function in $2n$ real numbers, for $n$ around 50. The initial numbers are of magnitude $\pm10$ and are rounded to $.001$, and I need the output also up to $.001$. I am using Newton's formulæ: for, say, $x_1$, ..., $x_{100}$ I first compute $p_k=x_1^k+...+x_{100}^k$, $k=1,2,...$, and then recursively find $$ e_j=\frac1j(p_1e_{j-1}-p_2e_{j-2}+p_3e_{j-3}-...) $$ starting from $e_0=1$ and going up to $e_{50}$. I seem to lose precision catastrophically, since the final expressions where I have to use the $e_{50}$ must be between 0 and 1 while I sometimes obtain something above $10^{25}$ and sometimes something negative.

So, what is the correct way to calculate $e_{50}$ correctly to $.001$ in this situation?

And it would be really great if the answer would reveal some general principle for dealing with similar calculations, since obviously there is a general issue of this kind which does not involve specifics of my case at all.

$\endgroup$
  • $\begingroup$ To clarify: all you have are the power sums, and you need to convert them to elementary symmetric polynomials? If you have the arguments themselves, then use SymmetricPolynomial[] directly. (In general, Newton-Girard is not very numerically reliable, so you need very high precision if you don't have exact numbers.) $\endgroup$ – J. M. is away Apr 7 '17 at 9:21
  • $\begingroup$ @J.M. I tried this, maybe I do something wrong but I got the message Cannot create a polynomial with 100891344545564193334812497256 terms. As for power sums - maybe I lose precision already finding them too, I don't know. I have the $x$es and I need their elementary symmetric functions $\endgroup$ – მამუკა ჯიბლაძე Apr 7 '17 at 9:27
  • $\begingroup$ Hmm, yes, SymmetricPolynomial[50, RandomReal[1, 100]] fails; I haven't looked at it in a while, but I'm not sure why there's this limitation. Can you try SeriesCoefficient[Product[c t - 1, {c, xlist}], {t, 0, 50}], please? $\endgroup$ – J. M. is away Apr 7 '17 at 9:30
  • 1
    $\begingroup$ If you don't mind a bit of a wait, I'll write one later; I've got something running... $\endgroup$ – J. M. is away Apr 7 '17 at 10:23
  • 2
    $\begingroup$ Various ways of calculating elementary symmetric polynomial can be found in: Finding column with maximum sum of by-element products of column subsets efficiently? $\endgroup$ – jkuczm Apr 7 '17 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.