Ask Your Question

What does Sage offer for expression manipulations?

asked 2015-11-02 06:07:04 +0200

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 10:39:39 +0200

tmonteil gravatar image

updated 2015-11-02 16:21:30 +0200

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 22:53:13 +0200 )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-02 06:07:04 +0200

Seen: 285 times

Last updated: Nov 02 '15