Evaluating high-degree polynomials

  • Thread starter Thread starter Undoubtedly0
  • Start date Start date
  • Tags Tags
    Polynomials
Click For Summary

Discussion Overview

The discussion revolves around the evaluation of high-degree Chebyshev polynomials of the first kind, specifically addressing issues related to numerical precision in computational tools like MATLAB. Participants explore the implications of polynomial coefficients and suggest alternative evaluation methods.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant notes that MATLAB produces results for high-degree Chebyshev polynomials that exceed the expected bounds of -1 to 1, attributing this to precision issues.
  • Another participant points out that the MATLAB file used may not be reliable, suggesting that it misrepresents the polynomial coefficients.
  • It is mentioned that the coefficients of T_{60} can be very large, leading to numerical instability when evaluating the polynomial directly.
  • One participant shares their experience of writing their own coefficient generator but still encountering similar issues, indicating that the problem persists regardless of the approach taken.
  • A participant suggests using the cosine-arcosine property of Chebyshev polynomials as a potentially simpler and more reliable method for evaluation.

Areas of Agreement / Disagreement

Participants generally agree that precision issues are a significant factor in evaluating high-degree Chebyshev polynomials, but there is no consensus on the best method for evaluation. Multiple approaches are discussed, and the effectiveness of each remains unresolved.

Contextual Notes

Limitations include the dependence on the accuracy of the coefficient representation in MATLAB and the inherent challenges of numerical evaluation of polynomials with very large coefficients.

Undoubtedly0
Messages
98
Reaction score
0
Hi all. I am trying to evaluate high-degree Chebyshev polynomials of the first kind. It is well known that for each Chebyshev polynomial T_n, if -1\le x\le1 then

-1\le T_n(x)\le 1

However, when I try to evaluate a Chebyshev polynomial of a high degree, such as T_{60}, MATLAB gives results that do not stay within these bounds. I assume this is due to a lack of precision. Any suggestions?

As an example, try

Code:
>> x = 0.9;
>> p60 = ChebyshevPoly(60);
>> polyval(p60,x)

ans =

  -1.4447e+04

where ChebyshevPoly() comes from mathworks.com.
 
Physics news on Phys.org
First off, that file isn't from the Mathworks; it's a user submission to the Matlab File Exchange. As you've learned, anything you get from there should be treated with suspicion until it's known to be good.

You're also correct that this is a precision issue. The first few terms in the 60-degree polynomial are

1 - 1800 x^2 + 539400 x^4 - 64440320 x^6 + \cdots

That Matlab file, however, thinks that there are lots of vanishing coefficients where in fact there shouldn't be. You can see this for yourself by running
Code:
ChebyshevPoly(60) < eps
and looking for the zeros.

You could try writing the routine yourself; a look at numerical recipes suggests it isn't that hard.
 
Thanks for the response, coalquay404. I think the command you meant to use was

Code:
abs(ChebyshevPoly(60)) < eps

I have previously written my own coefficient generator, but achieved only the same bad results. Any thoughts?
 
Undoubtedly0 said:
Thanks for the response, coalquay404. I think the command you meant to use was

Code:
abs(ChebyshevPoly(60)) < eps

I have previously written my own coefficient generator, but achieved only the same bad results. Any thoughts?

Yes, that's what I'd expect. Take a look at the coefficients of T_{60} and you'll see they go as high as ~3x10^21 (and as low as -3x10^21). Evaluating the polynomial will involve differences of very large numbers of this sort of magnitude, so with double precision only extending to about 15 significant figures, it's not surprising that you're getting erratic results.

You'll probably get "ok" results (correct to several significant digits) if the coefficients don't exceed about the +/- 10^12 range. I just checked T35 for example, and the coefficients extend to about +/- 2.4x10^12 and got the following results.

Matlab polyval(T35,0.9) returned 0.99689, while cos(35*acos(0.9)) returned 0.99696, which agrees, but only to 3 (nearly 4) significant digits.
 
Thanks uart. Through what you said I have realized that it would far far easier to simply evaluate the polynomials using the cosine-arcosine property, rather than evaluating the polynomials directly. Thanks!
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
27
Views
4K
  • · Replies 6 ·
Replies
6
Views
5K
  • · Replies 96 ·
4
Replies
96
Views
12K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K