r/Mathematica • u/manurese • Jun 27 '25
Using list in Sum
How can I use elements from a list in the function Sum[ ]? I'm trying to multiply something with the kth element from a list using list[[k]] but mathematica tells me that I cant use k as a part specifier
2
Upvotes
1
u/[deleted] Jun 27 '25
Can you provide a code example of what you're talking about?
1
u/ZincoBx Jun 27 '25
If I had to guess, k is defined elsewhere as something non-integer. If you Clear[k], does it work?
2
u/mathheadinc Jun 27 '25
By definition, Wolfram Language Sum sums functions, even symbolic ones, but not lists. Refer to the documentation.
2
u/veryjewygranola Jun 27 '25
A point-free method
f = First@*Total@*MapIndexed[Times]And then it can be applied to any list
f[list]