Ask Your Question
1

sage doesn't evaluate

asked 2015-10-14 15:49:11 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

If I say f(x) = sum(k,k,0,x) and then f(2), I get 3, of course, but if I say g(x) = (binomial(10,k),k, 0,x) and then g(2), sage doesn't evaluate, just returns the definition with x replaced by 2. Why? Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-10-15 08:35:31 +0100

rws gravatar image

updated 2015-10-15 08:36:02 +0100

Use simplify_full:

sage: f(x) = sum(k,k,0,x)
sage: f
x |--> 1/2*x^2 + 1/2*x
sage: f(x) = sum(binomial(10,k),k, 0,x)
sage: f
x |--> sum(binomial(10, k), k, 0, x)
sage: f(2)
sum(binomial(10, k), k, 0, 2)
sage: f(2).simplify_full()
56
edit flag offensive delete link more

Comments

Maybe I'm using an older version. The answer I get for f(2).simplify_full() is 3628800 * sum(1/(factorial(k) * factorial(-k + 10)), k,0,2)

mariopablo gravatar imagemariopablo ( 2015-10-15 14:11:13 +0100 )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-10-14 15:49:11 +0100

Seen: 480 times

Last updated: Oct 15 '15