Ask Your Question
0

What does Sage offer for expression manipulations?

asked 9 years ago

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);
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
3

answered 9 years ago

tmonteil gravatar image

updated 9 years ago

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))
Preview: (hide)
link

Comments

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

Peter Luschny gravatar imagePeter Luschny ( 9 years ago )

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: 9 years ago

Seen: 354 times

Last updated: Nov 02 '15