RE: Simple Sum problem

*To*: mathgroup at smc.vnet.net*Subject*: [mg44517] RE: [mg44499] Simple Sum problem*From*: "David Park" <djmp at earthlink.net>*Date*: Thu, 13 Nov 2003 02:27:09 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

Peter, Define a pure function fsum = Sum[#, {i, 1, npts}] & and then Map it onto your sum of terms. fsum /@ (a*i^2 + e[i]) Or define a new sum fumction this way... gsum[expr_, iter_] := Module[{wexpr = Expand[expr]}, If[Head[wexpr] === Plus, Sum[#, iter] & /@ wexpr, Sum[#, iter] &[wexpr]]] gsum[a i^2 + e[i], {i, 1, npts}] gsum[a i^2, {i, 1, npts}] David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: P.Z. Takacs [mailto:takacs at bnl.gov] To: mathgroup at smc.vnet.net I have an algebra Sum problem where I am trying to sum the product of two terms. The first term contains the index integer raised to various powers. The second term is an unspecified function identified by the index integer. A typical expression would be: Sum[a i^2 + en[i], {i, 1, npts}] . Mathematica returns the result unchanged, as if it does not know what to do with this expression. However, if I break it up into its individual terms, I get the following: The first term is just a geometric series: Sum[a i^2 , {i, 1, npts}] and Mathematica returns the correct result: 1/6*a*npts*(1 + npts)*(1 + 2*npts). The second term remains unchanged in symbolic form, as it should be: Sum[en[i] , {i, 1, npts}] = Sum[en[i] , {i, 1, npts}]. How can I get Sum to evaluate the geometric series term in the combined expression but leave the second term in symbolic form? I am trying to investigate the statistical properties of noisy data on various geometrical properties of polynomial curve fits, such as the position of the minimum in a 2nd order fit. The noise term needs to be carried through the least squares fit procedure symbolically so that it can be replaced with the appropriate expectations values at the proper time. I haven't been able to find a way to do this in Mathematica. Maybe someone knows a solution to this problem. Thanks in advance. Peter Takacs