public void Factorial() { var expr = MathS.Factorial(x + 3) / MathS.Factorial(x + 1); Assert.Equal(MathS.Pow(x, 2) + x * 3 + (2 * x + 6), expr.Expand()); expr = MathS.Factorial(x + -3) / MathS.Factorial(x + -1); Assert.Equal(1 / (x + -2) / (x + -1), expr.Expand()); }
[Fact] public void TestFormula27() => Assert.Equal(MathS.Factorial("-1"), FromString("(-1)!"));
[Fact] public void TestFormula26() => Assert.Equal(-MathS.Factorial(1), FromString("-1!"));
[Fact] public void TestFormula25() => Assert.Equal(Pow(MathS.Factorial(2), Factorial(x + 2)), FromString("2!^(x+2)!"));
[Fact] public void TestFormula24() => Assert.Equal(Pow(MathS.Factorial(2), MathS.Factorial(3)), FromString("2!^3!"));
[Fact] public void TestFormula23() => Assert.Equal(Pow(2, MathS.Factorial(3)), FromString("2^3!"));
[Fact(Skip = "Why StackOverflow here?")] public void TestFormula27() => Assert.Equal(MathS.Factorial(-1), FromString("(-1)!"));
// x!! is the double factorial, (x!)! is factorial appplied twice which is different [Fact] public void FactorialFactorialX() => Test(@"\left(x!\right)!", MathS.Factorial(MathS.Factorial(x)));
[Fact] public void FactorialSinX() => Test(@"\sin\left(x\right)!", MathS.Factorial(MathS.Sin(x)));
[Fact] public void FactorialX() => Test(@"x!", MathS.Factorial(x));
[Fact] public void Factorial1PI() => Test(@"\left(1 + i\right)!", MathS.Factorial(1 + MathS.i));
[Fact] public void Factorial1MI() => Test(@"\left(1 - i\right)!", MathS.Factorial(1 - MathS.i));
[Fact] public void FactorialI() => Test(@"i!", MathS.Factorial(MathS.i));
[Fact] public void FactorialM23() => Test(@"\left(-23\right)!", MathS.Factorial(-23));
[Fact] public void Factorial23() => Test(@"23!", MathS.Factorial(23));
[Fact] public void Factorial1() => Test(@"1!", MathS.Factorial(1));