Code covered by the BSD License  

Highlights from
Chebfun V4

image thumbnail

Chebfun V4

by

 

30 Apr 2009 (Updated )

Numerical computation with functions instead of numbers.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

vectornorms
function pass = vectornorms

% Sets up a chebfun with two pieces and
% checks various of its norms.
% (A Level 0 chebtest)

% Nick Trefethen  27 October 2008

f = chebfun(1,2,0:4:8);
norms(1) = norm(f,1);
norms(2) = norm(f,2);
norms(3) = norm(f,inf);
norms(4) = norm(f,'fro');
norms(5) = norm(f',1);
norms(6) = norm(f',2);
norms(7) = norm(f',inf);
norms(8) = norm(f','fro');
s = sqrt(20);
exact = [12 s 2 s 12 s 2 s];
pass = norms-exact < 1e-14*chebfunpref('eps')/eps;

Contact us