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$
4
  • 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, 2019 at 9:20
  • $\begingroup$ Yes. That is right. $\endgroup$
    – user120911
    Aug 23, 2019 at 9:30
  • $\begingroup$ Cool, I'll add it as an answer to the original post. $\endgroup$
    – Fraccalo
    Aug 23, 2019 at 9:52
  • 3
    $\begingroup$ What about Nmax Total[1 - 1/n]? $\endgroup$ Aug 23, 2019 at 14:35

2 Answers 2

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 and acknowledge you have read our privacy policy.

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