Ask Your Question
0

Binomial in a Summation

asked 11 years ago

david8381 gravatar image

updated 11 years ago

sage: var('k')

k

sage: sum(binomial(5,k),k,0,5)

I get an error "cannot convert k to int"

But if instead I try something like sum(binomial(n,k),k,0,n), everything is just fine.

Anyone know how I can get around this?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 11 years ago

calc314 gravatar image

Sum is working only in a symbolic ring. So you can convert your integers to the symbolic ring as follows:

sum(binomial(SR(5),k),k,0,SR(5))

You can also use the add command:

add([binomial(5,k) for k in [0..5]])
Preview: (hide)
link

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 11 years ago

Seen: 1,463 times

Last updated: Jul 25 '13