funPathological

PURPOSE ^

% Pathological function

SYNOPSIS ^

function [p,dp]=funPathological(xx)

DESCRIPTION ^

% Pathological function
L. LAURENT -- 21/03/2017 -- luc.laurent@lecnam.net

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Pathological function
0002 %L. LAURENT -- 21/03/2017 -- luc.laurent@lecnam.net
0003 
0004 % sources available here:
0005 % https://bitbucket.org/luclaurent/optigtest/
0006 % https://github.com/luclaurent/optigtest/
0007 
0008 % optiGTest - set of testing functions    A toolbox to easy manipulate functions.
0009 % Copyright (C) 2017  Luc LAURENT <luc.laurent@lecnam.net>
0010 %
0011 % This program is free software: you can redistribute it and/or modify
0012 % it under the terms of the GNU General Public License as published by
0013 % the Free Software Foundation, either version 3 of the License, or
0014 % (at your option) any later version.
0015 %
0016 % This program is distributed in the hope that it will be useful,
0017 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0018 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0019 % GNU General Public License for more details.
0020 %
0021 % You should have received a copy of the GNU General Public License
0022 % along with this program.  If not, see <http://www.gnu.org/licenses/>.
0023 
0024 %
0025 %global minimum : f(x)=-1 for xi=0
0026 %
0027 %Design space: -100<xi<100
0028 %
0029 
0030 
0031 
0032 function [p,dp]=funPathological(xx)
0033 %constants
0034 a=100;
0035 b=1/2;
0036 c=1e-3;
0037 
0038 %evaluation and derivatives
0039 xi=xx(:,:,1:end-1);
0040 xii=xx(:,:,2:end);
0041 %
0042 xA=a*xii.^2+xi.^2;
0043 xB=xi-xii;
0044 %
0045 sqA=sqrt(xA);
0046 sA=sin(sqA);
0047 pA=sA.^2-b;
0048 %
0049 pB=c*xB.^4+b;
0050 %
0051 pt=pA./pB;
0052 %
0053 p=sum(pt,3);
0054 %
0055 if nargout==2
0056     %
0057     dp=zeros(size(xx));
0058     %
0059     cA=cos(sqA);
0060     %
0061     dp(:,:,1)=(2*xx(:,:,1)./sqA(:,:,1).*sA(:,:,1).*cA(:,:,1).*pB(:,:,1)...
0062         -4*c*xB(:,:,1).^3.*pA(:,:,1))./pB(:,:,1).^2;
0063     %
0064     dp(:,:,end)=(2*a*xx(:,:,end)./sqA(:,:,end).*sA(:,:,end).*cA(:,:,end).*pB(:,:,end)...
0065         +4*c*xB(:,:,end).^3.*pA(:,:,end))./pB(:,:,end).^2;
0066     %
0067     dp(:,:,2:end-1)=(2*xx(:,:,2:end-1)./sqA(:,:,2:end).*sA(:,:,2:end).*cA(:,:,2:end).*pB(:,:,2:end)...
0068         -4*c*xB(:,:,2:end).^3.*pA(:,:,2:end))./pB(:,:,2:end).^2 ...
0069         +(2*a*xx(:,:,2:end-1)./sqA(:,:,1:end-1).*sA(:,:,1:end-1).*cA(:,:,1:end-1).*pB(:,:,1:end-1)...
0070         +4*c*xB(:,:,1:end-1).^3.*pA(:,:,1:end-1))./pB(:,:,1:end-1).^2;
0071 end

Generated on Tue 28-May-2019 16:00:34 by m2html © 2005