X-Git-Url: http://gitweb.michael.orlitzky.com/?p=octave.git;a=blobdiff_plain;f=optimization%2Ftest_functions%2Ftrigonometric_gradient1.m;h=845dc3290d41fd1fab2efcf87ab163d3e88233c4;hp=134ce8699bebb2f850f427df344a56b6f086d14f;hb=b12c6c2a4bf4cef29b2e08b743c92889505c7ed9;hpb=e1b71b4ca7cfa08ac76744a17a3778d4ccfaa7e2 diff --git a/optimization/test_functions/trigonometric_gradient1.m b/optimization/test_functions/trigonometric_gradient1.m index 134ce86..845dc32 100644 --- a/optimization/test_functions/trigonometric_gradient1.m +++ b/optimization/test_functions/trigonometric_gradient1.m @@ -1,8 +1,8 @@ function g = trigonometric_gradient1(x) - ## - ## The gradient of the trigonometric function. See trigonometric1.m - ## for more information. - ## + % + % The gradient of the trigonometric function. See trigonometric1.m + % for more information. + % n = length(x); g = zeros(n,1); @@ -12,13 +12,13 @@ function g = trigonometric_gradient1(x) f_k = n - cos_sum + k*(1 - cos(x(k))) - sin(x(k)); for j = [ 1 : n ] - ## Add to the jth component of g the partial of f^2 with - ## respect to x(j). The first term that we add here exists - ## regardless of j. + % Add to the jth component of g the partial of f^2 with + % respect to x(j). The first term that we add here exists + % regardless of j. g(j) = g(j) + 2*f_k*sin(x(j)); if (j == k) - ## But this term vanishes when j != k. + % But this term vanishes when j != k. g(j) = g(j) + 2*f_k*k*sin(x(k)) - 2*f_k*cos(x(k)); end end