source: MML/trunk/machine/SOLEIL/common/toolbox/chebfun_v2_0501/chebfun/chebtests/composetest.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 11 years ago

Initial import--MML version from SOLEIL@2013

File size: 684 bytes
Line 
1function pass = composetest
2
3% Rodrigo Platte, May 2009
4% Test composition of two chebfuns (quasimatrices)
5
6% Quasimatrices:
7tol = chebfunpref('eps')*10;
8x = chebfun('x',[0 1]);
9f = chebfun(@sin);
10X = [1 x x.^2];
11pass(1) =  norm(f(X) - sin(X),inf) < tol;
12
13XX = X(X);
14XX2 = [1 x x.^4];
15pass(2) =  norm(XX - XX2,inf) < tol;
16
17% Smooth functions
18x = chebfun('x');
19f = sin(x);
20g = sin(sin(x));
21pass(3) = norm(f(f) - g) < 10*tol;
22
23% Functions with jumps:
24h = chebfun(@(x) sign(x), [-2 0 2], 'splitting',1);
25fh = chebfun(@(x) sin(sign(x)), [-2 0 2], 'splitting',1);
26pass(4) = norm(f(h) - fh, inf) < tol;
27
28% Function handles;
29g = @(x) abs(x);
30f = x.^2;
31pass(5) = norm(f(g) - f, inf) < tol;
32
33
Note: See TracBrowser for help on using the repository browser.