4
$\begingroup$

Consider the polynomial $$ p(x) = -514-462 x+359 x^2+1129 x^3+165 x^4+490 x^5-418 x^6+497 x^7-227 x^8+60 x^9-10 x^{10}, $$ whose root $A\approx 3.14$ is very close to $\pi$: $$|A-\pi|=2.0746\times 10^{-33}.$$

Let's say I am given as input the eleven integer coefficients above, and nothing else. Is there a way to do calculate $\sin A$ that doesn't use multiple-precision floating-point arithmetic, just the regular double-precision arithmetic? (With multiple-precision arithmetic this is trivial, so I would like to know if there are any methods or ideas that could apply here with this restriction in place.)

$\endgroup$
  • $\begingroup$ So the question is "Given a polynomial, compute the sine of its roots (approximately) without computing the roots"? $\endgroup$ – Christian Clason Oct 29 '14 at 22:08
  • $\begingroup$ @ChristianClason Yes, but that's only numerically tricky when the root is close to a multiple of $\pi$, otherwise simply $\sin A$ will work well. $\endgroup$ – Kirill Oct 29 '14 at 22:15
  • $\begingroup$ Maybe it would help if you described what you are doing now, and how precisely this fails for you? $\endgroup$ – Christian Clason Oct 29 '14 at 22:30
  • $\begingroup$ @ChristianClason I came across this polynomial while looking for algebraic relations almost satisfied by $\pi$. I realized that it's tricky to compute $|A-\pi|$ and $\sin A$ without access to high-precision arithmetic, and I couldn't think of a way to do it directly. So the problem is already self-contained in that sense; there's already a trivial way to do it (with high-precision arithmetic), and I am curious whether I am missing some interesting idea that I don't know about yet. $\endgroup$ – Kirill Oct 29 '14 at 23:23
1
$\begingroup$

It probably depends on how much accuracy you want.

Call $\pi - A = d$. If you know $d$, then you could use $\sin(\pi - x) = \sin(x)$, and evaluate $\sin(d)$. It's very close to zero, and a first-order Taylor series yields $\sin(d) \approx d$. (Python's math.sin(2e-33) yields 2 \times 10^{-33} to at least 10 significant digits.) Additional terms in the Taylor series will be negligible, but arbitrary precision arithmetic will be more accurate.

To calculate $d$, you can replace $x$ in your polynomial with $\pi - d$ and solve for it using a standard root finder; I used Newton's method and got approximately -2.075e-33. Of course, this method makes use of the knowledge that the root of interest of the original polynomial is close to $\pi$, but it's a standard type of trick in numerical analysis.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ I'm not sure I understand what you mean: $fl(A)=fl(\pi)$, and using double-precision $\sin$ will not give the right answer. Computing $\pi-A$ in double precision gives exactly $0$. I am not assuming that I have already computed $|A-\pi|$. $\endgroup$ – Kirill Oct 29 '14 at 20:47
  • $\begingroup$ Based on your question, I thought you might have access to an accurate value of $\pi - A$. If you don't, this answer won't work. $\endgroup$ – Geoff Oxberry Oct 29 '14 at 21:01

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.