% Trefethen function L. LAURENT -- 23/02/2017 -- luc.laurent@lecnam.net
0001 %% Trefethen function 0002 % L. LAURENT -- 23/02/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 %1 minimum global: f(-0.02440307923,0.2106124261)=-3.3068686474 0025 % 0026 %Design space -5<xi<5 0027 0028 0029 function [p,dp] = funTrefethen(xx) 0030 0031 %constants 0032 a=0.25; 0033 b=0.25; 0034 c=50; 0035 d=10; 0036 e=60; 0037 f=70; 0038 g=80; 0039 0040 %evaluation and derivatives 0041 x=xx(:,:,1); 0042 y=xx(:,:,2); 0043 % 0044 sx=sin(c*x); 0045 sa=sin(d*x+d*y); 0046 sb=sin(e*exp(y)); 0047 sc=sin(f*sin(x)); 0048 sd=sin(sin(g*y)); 0049 % 0050 p=a*x.^2+b*y.^2+exp(sx)-sa ... 0051 +sb+sc+sd; 0052 0053 if nargout==2 0054 % 0055 dp=zeros(size(xx)); 0056 % 0057 ca=cos(d*x+d*y); 0058 % 0059 dp(:,:,1)=2*a*x+c*cos(c*x).*exp(sx) ... 0060 -d*ca+f*cos(x).*cos(f*sin(x)); 0061 dp(:,:,2)=2*b*y-d*ca ... 0062 +e*exp(y).*cos(e*exp(y)) ... 0063 +g*cos(g*y).*cos(sin(g*y)); 0064 end 0065 end