function [ fout , sglout ] = transf( fin , sglin , ival ) %TRANSF Transformation from a real interval onto the interval [-1,1] % [FOUT,SGLOUT]=TRANSF(FIN,SGL,IVAL) transforms a (matrix-valued) % function FIN with singularities in SGLIN, defined on the interval(s) % IVAL of the form [a_i,b_i], with -inf =< a_i < b_i =< inf, into the % function(s) FOUT_i with singularities SGLOUT_i defined on the interval % [-1,1] such that int(FIN(x),x=a_i..b_i) == int(FOUT_i(x),x=-1..1). IVAL % should be a matrix of size N x 2, where N denotes the number of % intervals, with IVAL(i,1)sizeF(2), fout = @(x) [fout(x), f(x)]; else fout = @(x) [fout(x); f(x)]; end sglout = [sglout;s]; end evalCounter=evalsC; end % ------------------------------------------------------------------------- function [ fout , sglout ] = tfsingle( fin , sglin , ival ) % Transformation for one single interval k = isinf(ival(1))+2*isinf(ival(2)); switch k, case 0, su = sum(ival); di = diff(ival); tau = @(x) (di*x+su)/2; taup = @(x) di/2; sglout = (2*sglin-su)/di; case 1, su = ival(2)-1; di = ival(2)+1; tau = @(x) (di*x+su)./(x+1); taup = @(x) 2./((x+1).^2); sglout = (sglin-su)./(di-sglin); case 2, su = -(ival(1)+1); di = ival(1)-1; tau = @(x) (di*x+su)./(x-1); taup = @(x) 2./((x-1).^2); sglout = (sglin+su)./(-di+sglin); otherwise tau = @(x) x./(1-x.^2); taup = @(x) (1+x.^2)./((1-x.^2).^2); di = length(sglin); sglout = (-1+sqrt(1+4*sglin.^2))./(2*sglin); sglout = [sglout;(-1-sqrt(1+4*sglin.^2))./(2*sglin)]; end fout = @(x) fin(tau(x)).*taup(x); end