CanvasTest.TestUtilities.TestGoldenSectionSearch C# (CSharp) Method

TestGoldenSectionSearch() private method

private TestGoldenSectionSearch ( ) : void
return void
        public void TestGoldenSectionSearch()
        {
            double res = Utilities.GoldenSectionSearch(x => x * x, -5, 5);
            Assert.IsTrue(Math.Abs(res) < 0.001);

            res = Utilities.GoldenSectionSearch(x => x * x, 0, 5);
            Assert.IsTrue(Math.Abs(res) < 0.001);

            res = Utilities.GoldenSectionSearch(x => x * x, -5, 0);
            Assert.IsTrue(Math.Abs(res) < 0.001);
        }