where
is solved.
using System;
using Imsl.Math;
public class BoundedLeastSquaresEx1 : BoundedLeastSquares.IFunction
{
public void F(double[] x, double[] f)
{
f[0] = 10.0 * (x[1] - x[0] * x[0]);
f[1] = 1.0 - x[0];
}
public static void Main(String[] args)
{
int m = 2;
int n = 2;
int ibtype = 0;
double[] xlb = new double[] { -2.0, -1.0 };
double[] xub = new double[] { 0.5, 2.0 };
BoundedLeastSquares.IFunction rosbck =
new BoundedLeastSquaresEx1();
BoundedLeastSquares zf =
new BoundedLeastSquares(rosbck, m, n, ibtype, xlb, xub);
zf.Solve();
new PrintMatrix("Solution").Print(zf.GetSolution());
}
}
Solution
0
0 0.5
1 0.250000000009201
Link to C# source.