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

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

Initial import--MML version from SOLEIL@2013

File size: 766 bytes
Line 
1function pass = falknershan
2
3tol = chebfunpref('eps');
4dom = domain(0,6);
5beta = 0.5;
6
7I = eye(dom); D = diff(dom);
8
9f = @(u) D^3*u + u.*(D^2*u) + beta*(1-(D*u).^2);
10dfdu = @(u) D^3 + diag(D^2*u) + diag(u)*D^2 - 2*beta*diag(D*u)*D;
11
12% Initial guess satisfies u(0)=u'(0)=0, u'(dom(2))=1
13u = chebfun( @(x) x.^2/(2*dom(2)), dom );
14
15% Boundary conditions for the Newton correction
16bcleft = struct('op',{I,D},'val',{0,0});
17bcright = struct('op',D,'val',0);
18bc = struct('left',bcleft,'right',bcright);
19
20% Newton iteration
21du = Inf;  niter = 0;
22while norm(du)>1e-10*(tol/eps) && niter < 11
23  r = f(u); 
24  J = dfdu(u);
25  J.bc = bc;
26  J.scale = norm(u);
27  du = -(J\r);
28  u = (u+du);
29  niter = niter+1;
30end
31
32
33pass = abs( feval(diff(u,2),0) - 0.927680043004878) < 1e8*tol;
34
35
36
Note: See TracBrowser for help on using the repository browser.