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