]> gitweb.michael.orlitzky.com - octave.git/blob - optimization/test_functions/trigonometric1.m
Add trigonometric functions and their tests.
[octave.git] / optimization / test_functions / trigonometric1.m
1 function f = trigonometric1(x)
2 ##
3 ## The trigonometric function. See More, Garbow, and Hillstrom,
4 ## function #26.
5 ##
6 ## This function has a minimum with f(x) == 0. The suggested
7 ## starting point is x0=(1/n, 1/n,...).
8 ##
9 n = length(x);
10 f = 0;
11
12 cos_sum = sum(cos(x));
13
14 for k = [ 1 : n ]
15 f_k = n - cos_sum + k*(1 - cos(x(k))) - sin(x(k));
16 f = f + (f_k)^2;
17 end
18 end