Results 1 to 5 of 5

Thread: Anomaly relating to certain polynomials.

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151

    Anomaly relating to certain polynomials.

    A while ago I wrote a VB program to find the roots of polynomials. It easily found all the roots for polynomials of order 20-40, and I think might handle order 100 and beyond.

    Recently I discovered a polynomial for which it determined one of the roots to about 15 digits of precision (the practical limit for a PC). When evaluated for that root, the result was over 100,000 instead of being a close approximation to zero.

    At first I thought there was a bug in the program. After doing a lot of analysis and testing of the code, I realized that the anomaly was due to numerical calculation problems. The following special polynomial is an example which might cause this anomaly.
    • x50 - 1051 = 0

      The derivative of P(x) = x50 - 1051 is 50*x49

      This polynomial has a root at approximately 10.47

      Near that root the derivative is incredibly large, indicating an almost vertical slope near the root.

      The error when you evaluate the polynomial could be 50*x49 times the error in the calculation of the root. An error in the root of 10-20 could result in an error greater than 1025
    the precision of the polynomial evaluation is not predictable, but can be many orders of magnitude greater than the error in the precision of the root for high order polynomials.
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Re: Anomaly relating to certain polynomials.

    You could always manually calculate the digits in a string.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Anomaly relating to certain polynomials.

    Quote Originally Posted by kedaman
    You could always manually calculate the digits in a string.
    To evaluate such large numbers maybe you can try something on these lines:

    x50 = 1050 log x

    Also, to avoid directly solving the equation involving the large numbers, you can divide it. Solving

    x50 - 1051 = 0

    is equivalent to solving:

    (x/10)50 - 10 = 0

    or

    0.1 * (x/10)50 - 1 = 0
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151

    Re: Anomaly relating to certain polynomials.

    You folks seem to be misunderstanding the nature of this anomaly.

    There is no problem finding a very precise approximation to the roots of these polynomials. I know that my VB program gives about 15 digit precision. I verify precision by comparing the sum and product of the roots with polynomial coefficients.

    The problem is in evaluating the polynomial for certain roots. With a root accurate to 15 digits, the polynomial evaluation can be many orders of magnitude greater (or less) than zero. The following approximates the error in evaluating the polynomial at (root + Error).
    • Polynomial(root + Error) = Polynomial(root) + Error * Derivative(root)
    If the derivative near the root is larger than one, the error in evaluating the polynomial is larger than the error in the root approximation. If the derivative near the root is (for example) 1050, the error in polynomial evaluation can be orders of magnitude from zero even if approximation to the root is precise to 15 or 20 digits.
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

  5. #5
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Anomaly relating to certain polynomials.

    Quote Originally Posted by Guv
    The problem is in evaluating the polynomial for certain roots. With a root accurate to 15 digits, the polynomial evaluation can be many orders of magnitude greater (or less) than zero.
    Yes, the root may be (is) pretty accurate yet the absolute value of the polynomial for the calculated root may still be very large.

    I assume the problem is your (Newton?) algorithm quits if after so many loops x is lower than a very small value. Interesting challenge, I don't know if I'll be able to help but I'll think about it.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width