I am looking at the following equation:
$$\sum_{i=1}^n (a_i+b)^2 + \sum_{j=1}^m a_j$$
I am not sure what the convention for the order of operations for this would be.
Is it:
$$(\sum_{i=1}^n (a_i+b)^2) + \sum_{j=1}^m a_j$$
or
$$\sum_{i=1}^n ((a_i+b)^2 + \sum_{j=1}^m a_j)$$
Edit: If the plus sign was changed to a product, how would this be evaluated?
$$\sum_{i=1}^n (a_i+b)^2 \sum_{j=1}^m a_j$$
Like this:
$$(\sum_{i=1}^n (a_i+b)^2) \sum_{j=1}^m a_j$$
or
$$\sum_{i=1}^n ((a_i+b)^2 \sum_{j=1}^m a_j)$$
I suppose the general question I am trying to ask is twofold:
- What is the order of operations for sums?
- Searching "Order of operations" in Google doesn't help me find interesting results. What are the correct search terms?
As commented after the first paragraph of this answer to a related question, the expression
$$\sum_i c + d$$
is ambiguous. The usual convention is: if the second term don't depend on $i$ (the summation index) then the sum should not include it: $ (\sum_i c) + d$. Elsewhere (of course) it would include it: $ \sum_i (c + d)$.
In your example, this criterion would vote for your first interpretation - and I think this agrees with the way most people here would parse it:
$$\sum_{i=1}^n (a_i+b)^2 + \sum_{j=1}^m a_j = \left(\sum_{i=1}^n (a_i+b)^2\right) + \sum_{j=1}^m a_j$$
But it's better to avoid the ambiguity, and write it differently so that the precedence is clear.
See also here (actually, after seeing that, I'm wondering if this question should be closed as duplicated... )