% Pen Holder function L. LAURENT -- 17/11/2016 -- luc.laurent@lecnam.net
0001 %% Pen Holder function 0002 %L. LAURENT -- 17/11/2016 -- 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 %4 global minimas : f(x)=-1.037845 for x=[9.646167708023526, 9.646167671043401; 0026 %-9.646167708023526, 9.646167671043401; 0027 %9.646167708023526, -9.646167671043401; 0028 %-9.646167708023526, -9.646167671043401]; 0029 % 0030 %Design space: -11<xi<11 0031 0032 0033 function [p,dp]=funPenHolder(xx) 0034 0035 %constants 0036 a=1; 0037 b=pi; 0038 0039 %variables 0040 xxx=xx(:,:,1); 0041 yyy=xx(:,:,2); 0042 0043 %evaluation and derivatives 0044 sxy=a-sqrt(xxx.^2+yyy.^2)/b; 0045 g=exp(abs(sxy)); 0046 h=cos(xxx).*cos(yyy); 0047 % 0048 p=-exp(abs(g.*h).^(-1)); 0049 0050 if nargout==2 0051 dgX=-1/b*sign(sxy).*xxx./sqrt(xxx.^2+yyy.^2).*g; 0052 dgY=-1/b*sign(sxy).*yyy./sqrt(xxx.^2+yyy.^2).*g; 0053 dhX=-cos(yyy).*sin(xxx); 0054 dhY=-sin(yyy).*cos(xxx); 0055 % 0056 dp(:,:,1)=-sign(g.*h).*(g.*h).^(-2)... 0057 .*(dgX.*h+dhX.*g).*p; 0058 dp(:,:,2)=-sign(g.*h).*(g.*h).^(-2)... 0059 .*(dgY.*h+dhY.*g).*p; 0060 end 0061 end