コード例 #1
0
        public void MinBrent5()
        {
            double        eps      = 1e-5;
            double        xmin     = 0;
            double        realXmin = 0.78152;
            int           maxCount = 50;
            LineSearch    ls       = new LineSearch();
            TestFunction3 f        = new TestFunction3();

            double[] res     = new double[3];
            int      counter = ls.FindMinInterval(f, 1000, 1, 30, ref res);

            counter = ls.FindMinimumViaBrent(f, res[0], res[1], res[2], 50, eps, ref xmin);
            Assert.IsTrue(counter < maxCount);
            Assert.IsTrue(System.Math.Abs(xmin - realXmin) < eps);
        }
コード例 #2
0
ファイル: BrentTests.cs プロジェクト: kriskniaz/pCode
 public void MinBrent5()
 {
     double eps = 1e-5;
     double xmin=0;
     double realXmin = 0.78152;
     int maxCount = 50;
     LineSearch ls = new LineSearch();
     TestFunction3 f = new TestFunction3();
     double[] res = new double[3];
     int counter = ls.FindMinInterval(f,1000,1,30, ref res);
     counter = ls.FindMinimumViaBrent(f,res[0],res[1],res[2],50,eps,ref xmin);
     Assert.IsTrue(counter<maxCount);
     Assert.IsTrue (System.Math.Abs(xmin-realXmin)<eps);
 }