function f = beale ( x ) %% BEALE computes the Beale function. % % Discussion: % % This function has a global minimizer: % % X* = ( 3.0, 0.5 ), F(X*) = 0. % % For a relatively easy computation, start the search at % % X = ( 1.0, 1.0 ) % % A harder computation starts at % % X = ( 1.0, 4.0 ) % % Modified: % % 28 January 2008 % % Author: % % John Burkardt % % Reference: % % Evelyn Beale, % On an Iterative Method for Finding a Local Minimum of a Function % of More than One Variable, % Technical Report 25, % Statistical Techniques Research Group, % Princeton University, 1958. % % Richard Brent, % Algorithms for Minimization with Derivatives, % Dover, 2002, % ISBN: 0-486-41998-3, % LC: QA402.5.B74. % % Parameters: % % Input, real X(2), the argument of the function. % % Output, real F, the value of the function at X. % if ( length ( x ) ~= 2 ) error ( 'Error: function expects a two dimensional input\n' ); end f1 = 1.5 - x(1) * ( 1.0 - x(2) ); f2 = 2.25 - x(1) * ( 1.0 - x(2) * x(2) ); f3 = 2.625 - x(1) * ( 1.0 - x(2) * x(2) * x(2) ); f = f1 * f1 + f2 * f2 + f3 * f3;