Message Boards Message Boards


Solve the following equation with a Sum?

Posted 7 months ago
2 Replies
1 Total Likes

Consider the following code:

In[4]:= Solve[Sum[i, {i, 1, n}] == 253, n]

Out[4]= {{n -> -23}, {n -> 22}}

In[7]:= Solve[\!\(
\*UnderoverscriptBox[\(\[Sum]\), \(i = 1\), \(x\)] i\) == 253, x]

Out[7]= {{x -> -23}, {x -> 22}}

In[9]:= \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(i = 1\), \(22\)]i\)

Out[9]= 253
2 Replies

Are you concerned about the negative answer n->-23? That is because Sum[i, {i, 1, n}] is evaluated symbolically first to the polynomial n(1+n)/2, and Solve works with that polynomial. The replacement is only correct if n is positive, but Mathematica leaves that check to the user. Wolfram may resolve the issue with with ConditionalExpression or Piecewise, at the cost of slowing down calculations and making beginners confused.

Posted 7 months ago

Excellent. Thanks!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract