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

scaleinvariance2
function pass = scaleinvariance2

% Modification of scaleinvariance.m
% This code makes sure a few things are scale-invariant when the interval
% is split (tests endpoints).
% Rodrigo Platte
% (A Level 1 chebtest)

splitting on

d = [1 2];
scale = 2^100;
fh = @(x) abs(x-1.2)+10;

f = chebfun(fh,d);
maxf = max(f);

f1 = chebfun(@(x) fh(x*scale),d/scale);
pass(1) = (max(f1)==maxf) && all(f1.ends*scale == f.ends);

f2 = chebfun(@(x) fh(x/scale),d*scale);
pass(2) = (max(f2)==maxf) && all(f2.ends/scale == f.ends);

f3 = chebfun(@(x) fh(x)*scale,d);
pass(3) = (max(f3)==maxf*scale) && all(f3.ends == f.ends);

f4 = chebfun(@(x) fh(x)/scale,d);
pass(4) = (max(f4)==maxf/scale) && all(f4.ends == f.ends);


Contact us