0

I try

sum(k, k, 1, n+1)-sum(k, k, 1, n),simpsum;

Why does it give n+1?

collect(sum(k, k, 1, n+1)-sum(k, k, 1, n)); 

neither?

zx485
  • 28,498
  • 28
  • 50
  • 59
moueza
  • 69
  • 1
  • 7
  • 1
    After `sum(...) ...`, try `ratsimp(%)` or `expand(%)` -- does that yield the expected result? See also `simplify_sum`, which knows the same identities as `simpsum` and a lot more. Try `load("simplify_sum")` and then `simplify_sum()`. – Robert Dodier Jun 12 '23 at 01:39
  • sum(k, k, 1, n+1)-sum(k, k, 1, n),simpsum;ratsimp(%); gives the correct result n+1. Thank you @Robert Dodier – moueza Jun 12 '23 at 07:21
  • sum(k, k, 1, n+1)-sum(k, k, 1, n),simpsum;expand(%); too ! – moueza Jun 12 '23 at 07:24
  • load("simplify_sum");simplify_sum(sum(k, k, 1, n+1)-sum(k, k, 1, n)); fails – moueza Jun 12 '23 at 07:27
  • When you say simplify_sum fails, I guess you just mean that it doesn't give the simplest form and you have to apply `expand` or `ratsimp`. Well, just getting to an expression in `n` without the summations is the hard part of the problem, so I think the additional simplification is not a big deal. My main point about simplify_sum is that it applies many summation identities that simpsum doesn't know about. – Robert Dodier Jun 12 '23 at 17:05

0 Answers0