# Is it possible to make a series read a separately defined set of values?

I would like to plot a function with a sum in it. Here is the function:

$$v(k) = \sum_{j=1}^k \frac{v_E \cdot m_j \cdot c}{m_j(1-c)+\sum_{i=j+1}^n m_i}$$

As you can see, the problem is that I have a set of $$m_i$$ ($$m_1 = 12, m_2=35...$$) and now I set them manually. If I want to change the set or add new masses, I also have to do it manually.

Is there a way to define this set separately and then make the series "read" the elements of this set?

• why not make a function, and pass it the the maximum summation index k and n needed and the set m and v and also c ? – Nasser Mar 5 at 20:46
• @Nasser How do I define the set m? How do I make the sum find the appropriate value for m matching the index? – Conny Dago Mar 5 at 20:52
• The set m is just a list, right? This is the input you have, right? If you give a small example of your data v and m it helps. – Nasser Mar 5 at 20:56
• @Nasser Yes, the set of m-s is just a list and it is the input. m has to contain arbitrary real values (m stands for masses) and the output is velocities. – Conny Dago Mar 5 at 21:23

## 2 Answers

Here is a sample implementation. See if I have understood your notation and goal:

ClearAll[v]
v[mList_, k_] :=
vE c Sum[mList[[j]] / (mList[[j]] (1 - c) + Total@mList[[j ;;]]), {j, 1, k}]


I assumed that vE and c are constants, and I gave them some arbitraty value; similarly, let's choose an arbitrary list of masses:

c = 0.5;
vE = 32;
mlist = {1, 45, 12, 35};

v[mlist, 4]
(* Out: 20.7486 *)


Let's plot it for a range of k:

Plot[v[{12, 45, 30, 35}, k], {k, 0, 4}] m = {12, 35, 48};ve = 12;mj = 14;c = 14;numofmasses = Length[m];tot = 0;
For[a2 = 1, a2 < numofmasses + 1, a2 = a2 + 1,
an[a2] = ve*Part[m, a2]*c/(Part[m, a2]*(1 - c) + Total[m[[a2 + 1 ;; numofmasses]]]);

tot = an[a2] + tot;
];
Print[tot]


Put your values for the variables and it will read along the masses

• be honest it was the plot – Rookey Mar 6 at 23:34