Ask Your Question

What does Sage offer for expression manipulations?

asked 2015-11-01 23:07:04 -0600

Peter Luschny gravatar image

I heard that advanced expression manipulation isn't Sage's strong side. But are there simple conversions like convert(expr, X) where X is in {factorial, binomial, Gamma, hypergeom, partfrac, etc.. }?

For example how to convert (n!/k!)*binomial(k,n-k) to factorials? With Maple this would look like:

convert( (n!/k!)*binomial(k,n-k), factorial);
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-11-02 03:39:39 -0600

tmonteil gravatar image

updated 2015-11-02 09:21:30 -0600

You can try to simplify your expression as follows:

sage: var('k,n')
(k, n)
sage: expr = n.factorial()/k.factorial()*binomial(k,n-k)
sage: expr.factorial_simplify()
factorial(n)/(factorial(2*k - n)*factorial(-k + n))
edit flag offensive delete link more


Thanks. See my follow-up question 30440: What guarantees simplify?

Peter Luschny gravatar imagePeter Luschny ( 2015-11-03 15:53:13 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-11-01 23:07:04 -0600

Seen: 128 times

Last updated: Nov 02 '15