1
$\begingroup$

Suppose I have a simple equation with indices, like the one shown in the image. How can I use Mathematica to implement it? I am aware of summing when a specific variable changes value of some range, but the stated problem is different. Here the index references to a location in a list, and the value in that list can be many things.

enter image description here

$\endgroup$
  • 2
    $\begingroup$ do you mean something like: Sum[((n[[j]] - 1) Nmax)/n[[j]], {j, i, Nmax}], where n is a list with at least Nmax elements? $\endgroup$ – Fraccalo Aug 23 at 9:20
  • $\begingroup$ Yes. That is right. $\endgroup$ – user120911 Aug 23 at 9:30
  • $\begingroup$ Cool, I'll add it as an answer to the original post. $\endgroup$ – Fraccalo Aug 23 at 9:52
  • 3
    $\begingroup$ What about Nmax Total[1 - 1/n]? $\endgroup$ – Henrik Schumacher Aug 23 at 14:35
5
$\begingroup$

Converting comment into an answer:

Sum[((n[[j]] - 1) Nmax)/n[[j]], {j, i, Nmax}]

, where n is a list with at least Nmax elements.

$\endgroup$
3
$\begingroup$

If n is you list, more elegant than Sum:

Total[1 - 1 / n] Length[n]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.