Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Can Sage simplify factorials?

I am starting out with Sage and am playing around with some simple equations involving factorials. I have not been able to find a way for Sage to simplify the equations. Does anyone know how, if possible, this is done? The set up is:

sage: var("x, y, z") (x, y, z) sage: eq1 = x^2 - y^2 == 0 sage: solve(eq1, x, y) ([x == -y, x == y], [1, 1])

sage: eq2 = factorial(x) - factorial(y) == 0 sage: solve(eq2, x, y) ([factorial(x) == factorial(y)], [1]) sage: eq2.simplify() factorial(x) - factorial(y) == 0 sage: eq2.simplify_factorial() factorial(x) - factorial(y) == 0 sage: eq2.simplify_full() factorial(x) - factorial(y) == 0

As you can see sage can handle polynomials in eq1 but does not seem to recognise that x == y is a solution for eq2. I have tried adding some assume commands in to restrict to positive integers but this does not help. I have not been able to find anything in the documentation so far about this seemingly simple situation which must occur frequently so if anyone has any suggestions please let me know.

Can Sage simplify factorials?

I am starting out with Sage and am playing around with some simple equations involving factorials. I have not been able to find a way for Sage to simplify the equations. Does anyone know how, if possible, this is done? The set up is:

sage: var("x, y, z") z")

(x, y, z) z)

sage: eq1 = x^2 - y^2 == 0 0

sage: solve(eq1, x, y) y)

([x == -y, x == y], [1, 1])

sage: eq2 = factorial(x) - factorial(y) == 0 0

sage: solve(eq2, x, y) y)

([factorial(x) == factorial(y)], [1]) sage: eq2.simplify() factorial(x) - factorial(y) == 0 sage: eq2.simplify_factorial() factorial(x) - factorial(y) == 0 sage: eq2.simplify_full() [1])

sage: eq2.simplify()

factorial(x) - factorial(y) == 0

sage: eq2.simplify_factorial()

factorial(x) - factorial(y) == 0

sage: eq2.simplify_full()

factorial(x) - factorial(y) == 0

As you can see sage can handle polynomials in eq1 but does not seem to recognise that x == y is a solution for eq2. I have tried adding some assume commands in to restrict to positive integers but this does not help. I have not been able to find anything in the documentation so far about this seemingly simple situation which must occur frequently so if anyone has any suggestions please let me know.