]> gitweb.michael.orlitzky.com - octave.git/blobdiff - optimization/test_functions/rosenbrock_gradient.m
Add the Rosenbrock functions and their tests.
[octave.git] / optimization / test_functions / rosenbrock_gradient.m
diff --git a/optimization/test_functions/rosenbrock_gradient.m b/optimization/test_functions/rosenbrock_gradient.m
new file mode 100644 (file)
index 0000000..50c4546
--- /dev/null
@@ -0,0 +1,9 @@
+function g = rosenbrock_gradient(x1, x2)
+  ##
+  ## The gradient of the Rosenbrock function. See rosenbrock.m for more
+  ## information.
+  ##
+  f_x1 = -400*x1*(x2 - x1^2) + 2*x1 - 2;
+  f_x2 = 200*(x2 - x1^2);
+  g = [f_x1; f_x2];
+end