source: MML/trunk/machine/SOLEIL/common/toolbox/chebfun_v2_0501/chebfun/chebtests/chebpolytest.m @ 17

Last change on this file since 17 was 17, checked in by zhangj, 10 years ago

To have a stable version on the server.

  • Property svn:executable set to *
File size: 814 bytes
Line 
1function pass = chebpolytest
2
3% Nick Trefethen  29 December 2008
4
5% Tests of the form chebfun = chebpoly(integer):
6
7tol = chebfunpref('eps');
8
9T5 = chebpoly(5);
10x = [0 .4 1];
11exact = [0 .88384 1];
12pass1 = (norm(T5(x)-exact)<1e-14*(tol/eps));
13
14T5b = chebpoly(5,[1,9]);
15xb = 4*x + 5;
16pass2 = (norm(T5b(xb)-exact)<1e-14*(tol/eps));
17
18T100 = chebpoly(100);
19pass3 = (abs(sum(T100)-(-2/9999)) < 1e-15*(tol/eps));
20
21% Tests of the form vector = chebpoly(chebfun):
22
23a = chebpoly(chebfun('exp(x).*sin(x)')); a = a(end:-1:1);
24exacta = [0.496529947609122 1.228320669845808 0.494795283026613];
25pass4 = (norm(a(1:3)-exacta)<1e-14*(tol/eps));
26
27% Combined tests:
28
29f = chebpoly(5) + .25*chebpoly(4);
30exactf = [1 .25 0 0 0 0];
31pass5 = norm(exactf - chebpoly(f)) < 1e-15*(tol/eps);
32
33pass = pass1 && pass2 && pass3 && pass4 && pass5;
34
Note: See TracBrowser for help on using the repository browser.