Message Boards Message Boards

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

Built-in WL function to count addends or terms ?

Posted 9 years ago

I have a long summation with many (thousands) addends like 1+1/(1+a) +1/(1+b)-3/(7+c)+ ... . Is there a simple built -in function in Mathematica that can count the addends of a long algebraic summation ? I mean a function that can count the number of terms added and/or subtracted ? Or do I have to convert the summation to a list by changing the + and - signs to commas?

POSTED BY: Moses Tenne
2 Replies
Posted 9 years ago

Thank you very much. That answers my question.

POSTED BY: Moses Tenne
In[3]:= Length[1 + 1/(1 + a) + 1/(1 + b) + 3/(7 + c)]

Out[3]= 4

That will work as long as the head of the entire expression is Plus, which includes expressions containing negative terms. since they are internalized as negative numbers times expressions, and the whole expression doesn't automatically simplify.

POSTED BY: Frank Kampas
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