circle.addPoint( 50.0, -6.0);
circle.addPoint(110.0, -20.0);
circle.addPoint( 35.0, 15.0);
circle.addPoint( 45.0, 97.0);
LevenbergMarquardtOptimizer optimizer = new LevenbergMarquardtOptimizer();
VectorialPointValuePair optimum =
optimizer.optimize(circle, new double[] { 0, 0, 0, 0, 0 }, new double[] { 1, 1, 1, 1, 1 },
new double[] { 98.680, 47.345 });
assertTrue(optimizer.getEvaluations() < 10);
assertTrue(optimizer.getJacobianEvaluations() < 10);
double rms = optimizer.getRMS();
assertEquals(1.768262623567235, FastMath.sqrt(circle.getN()) * rms, 1.0e-10);
Point2D.Double center = new Point2D.Double(optimum.getPointRef()[0], optimum.getPointRef()[1]);
assertEquals(69.96016176931406, circle.getRadius(center), 1.0e-10);
assertEquals(96.07590211815305, center.x, 1.0e-10);
assertEquals(48.13516790438953, center.y, 1.0e-10);
double[][] cov = optimizer.getCovariances();
assertEquals(1.839, cov[0][0], 0.001);