where
is solved.
import com.imsl.math.*; public class BoundedLeastSquaresEx1 { public static void main(String args[]) throws Exception { int m = 2; int n = 2; int ibtype = 0; double[] xlb = {-2.0, -1.0}; double[] xub = {0.5, 2.0}; BoundedLeastSquares.Function rosbck = new BoundedLeastSquares.Function() { public void compute(double[] x, double[] f) { f[0] = 10.0*(x[1] - x[0]*x[0]); f[1] = 1.0 - x[0]; } }; 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.25Link to Java source.