Ask Your Question
0

What does Sage offer for expression manipulations?

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

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
3

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

tmonteil gravatar image

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

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

Comments

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

Peter Luschny gravatar imagePeter Luschny ( 2015-11-03 15:53:13 -0500 )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

Stats

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

Seen: 66 times

Last updated: Nov 02 '15