예제 #1
0
        public void TestLambertW()
        {
            double[] input  = { -0.367879, -0.2, -0.1, 0, 0.5, 1, 2, 5, 10, 50, 10000, 1e50 };
            double[] target =
            { -0.998452103780727259318294980306402,
              -0.259171101819073745,
              -0.11183255915896296483356945682026584227264536229126586,
              0,
              0.351733711249195826024909300929951065171464215,
              0.5671432904097838729999686622103555497538,
              0.85260550201372549134647241469531746689,
              1.326724665242200223635099297758079660128793554638,
              1.74552800274069938307430126487538991153528812908,
              2.860890177982210866757626984338803536992633740,
              7.23184603809337270647561850014125388396765914,
              110.424918827313345741844606222084501335079416897000087 };

            var output = input.Select(Dsp.LambertW).ToReadOnlyList();

            FilterAssert.ListsAreReasonablyClose(output, target, 1e-13);
            Assert.Catch <ArgumentOutOfRangeException>(() => Dsp.LambertW(-1));
        }