source: MML/trunk/machine/SOLEIL/common/toolbox/chebfun_v2_0501/chebfun/chebtests/guide2tests.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: 1.3 KB
Line 
1
2function pass = guide2tests
3
4% LNT 25 May 2008
5% Various tests from chapter 2 of the Chebfun Guide.
6
7  splitting on
8
9  f = chebfun('log(1+tan(x))',[0 pi/4]);
10  I = sum(f); Iexact = pi*log(2)/8;
11  err1 = I-Iexact; pass1 = err1<chebfunpref('eps')*10;
12
13  f = chebfun('sin(sin(x))',[0 1]);
14  I = sum(f); Iexact = 0.4306061031206906049;
15  err2 = I-Iexact; pass2 = err2<chebfunpref('eps')*10;
16
17  t = chebfun('t',[0,1]);
18  f = 2*exp(-t.^2)/sqrt(pi);
19  I = sum(f); Iexact = erf(1);
20  err3 = I-Iexact; pass3 = err3<chebfunpref('eps')*10;
21
22  f = chebfun(@(x) abs(besselj(0,x)),[0 20]);
23  I = sum(f); Iexact = 4.4450316030016;
24  err4 = I-Iexact; pass4 = err4<chebfunpref('eps')*1e3;
25
26  x = chebfun('x');
27  f = sech(3*sin(10*x));
28  g = sin(9*x); h = min(f,g);
29  I = sum(h); Iexact = -0.38155644885025;
30  err5 = I-Iexact; pass5 = err5<chebfunpref('eps')*10;
31
32% splitting off
33% x = chebfun('x',[0 1]);
34% f = sech(10*(x-0.2)).^2 + sech(100*(x-0.4)).^4 + sech(1000*(x-0.6)).^6;
35% I = sum(f); Iexact = 0.210802735500549;
36% err6 = I-Iexact; pass6 = err6<chebfunpref('eps')*10;
37pass6 = 1; %commented out to save time
38
39% splitting on
40% f = sech(10*(x-0.2)).^2 + sech(100*(x-0.4)).^4 + sech(1000*(x-0.6)).^6;
41% I = sum(f);
42% err7 = I-Iexact; pass7 = err7<1e2*chebfunpref('eps');
43pass7 = 1; %commented out to save time
44
45  pass = pass1 && pass2 && pass3 && pass4 && pass5 && pass6 && pass7;
Note: See TracBrowser for help on using the repository browser.