Ask Your Question
0

Double sum

asked 2012-11-26 15:41:27 +0100

PB gravatar image

Hello,

I would like SAGE to compute a double sum like $\sum\limits_{1\le a\le n}\sum\limits_{1\le b\le n} \max(a,b)$. The result is strange :

f(n)=sum(sum(max(a,b),b,1,n),a,1,n)

SAGE tells me that f(2) is 6. But it is rather 7 (unless i am very tired).

Thank you for your advices :-)

Pierre

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2012-11-26 16:29:34 +0100

kcrisman gravatar image

In this case you may want to try max_symbolic. Try max(a,b) by itself and see what you get - maybe a?

edit flag offensive delete link more
0

answered 2012-11-26 16:48:26 +0100

PB gravatar image

Thank you. You are right : max(a,b) gives me a. I used max_symbolic instead, I get no error, but SAGE can't simplify the double sum.

edit flag offensive delete link more

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: 2012-11-26 15:41:27 +0100

Seen: 1,237 times

Last updated: Nov 26 '12