I should mention that I’m not just interested in this type of sum but also sums of the form Sum[a_i * b_i, i] / Sum[a_i * a_i, i] where removing the _i would give an incorrect answer.
Are you using “_i” as a notation for subscript? Subscripts in executable code need extra work. See the notebook attachment SubscriptedVariables101.nb in thread Global and local variables for suggestions.
For the second draft, try writing the code without subscripts.
If you mean “a_i” to be a variable name, that will not work in Wolfram Language. Underscore is a special character.
In[1]:= ?_
_ or Blank[] is a pattern object that can stand for any Wolfram Language expression.
_h or Blank[h] can stand for any expression with head h.
instead it just gives back the pretty printed version of the equation. Interestingly, I was able to use the Blank[] notation to get the behavior that I wanted, so I know Mathematica knows how to do this.
I don’t know if you quite realize what you did. Sum[..., {i,1}] will compute an explicit summation as i` goes from 1 to 1. I doubt the resulting simplification implies that Mathematica can do what (I believe) you actually want from it.
It looks like you might be trying to re-invent power sums and symmetric functions used in lots of combinatorial problems (which is a good thing). The power sums and symmetric polynomials are found in Mathematica and the add-on package mathStatica.
Is the following something that you’re trying to do?
Yes, you are very close to what I want to do except in topic areas–I’m doing statistics not combinatorics. I like what you wrote but I wonder, why should I have to specify n?
I have several vectors and will be taking inner products of them. Well, really, it’s just matrix algebra but I want to do it symbolically so that I can perhaps differentiate the result and figure out the sign of some partials. But first, I need the ability to do products of sums and simplify the results.
Daniel,
I should have mentioned that the Sum[…, {i,1}] notation was a hack that appeared to be working, not a solution that I thought represented my thoughts in Mathematica clearly. It does get things right like my first example and some simple ratios do what I expect when I apply Expand[].
I’m a statistician and use combinatorics in a lot of the work I do. (My major professor who was a statistician co-wrote a book called Combinatorial Chance - I highly recommend looking at that book for some of the things you might want to do with such sums as you’ve described.)
I also highly recommend the book called Mathematical Statistics with Mathematica written by Colin Rose and Murray Smith (which describes what’s in the mathStatica package I mentioned earlier). Chapter 7 deals with augmented symmetric functions.
About specifying n…To figure out general solutions using sums like you’ve used above sometimes one needs to specify a suite of particular n’s and hopefully a pattern will be recognized. Or you try 1, 2, 3, 4, … and some recursive pattern becomes apparent. But with augmented symmetric functions you won’t need to specify n to obtain the general results.
Given the goal, I wonder if the following approach might be of use. You are operating on explicit Sum objects. Perhaps commute this, that is, do the operation(s) on the general form of the jth term first, and then Sum over j.