Message Boards Message Boards

0
|
3153 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Solve the following equation with a Sum?

Posted 6 years ago

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
POSTED BY: Dennis Lawler
2 Replies

Excellent. Thanks!

POSTED BY: Dennis Lawler

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 BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract