I have a list of elements called q
and wish to compute Total Multiplicity of each element, and put these values in the list tm
.
I need to search for almost equal elements, then list them as a new list with each element's position.
This new list would contain several lists, because there are many elements that are equal relative to each other.
Here is an example:
q list from 0 to 200 correspond to certain values in tm length 201 same as q.
q={0,....,200};
tm={1,3,3,7,3,1,7,8,4}
lst of 3 elements {q,tm}={{1,3},{2,3},{4,3}}
lst1 of 1 elements {q,tm}={{0,1},{5,1}}
and so on...
Here is my code: Look at the last line where tm
is calculated.
n = 200; "Whole"
q = 200; "Whole"
na = 1; "System"
nb = 199; "Reservoir"
m[n_, q_] := N[(q + n - 1)!/(q!*(n - 1)!)];
qa = Table[q[j], {j, 0, q}];
qb = Reverse[Table[q[j], {j, 0, q}]];
qa1 = qa[[All,1]];
qb1 = qb[[All,1]];
"System Multiplicity"
ma = m[na, qa1];
"Reservoir Multiplicity"
mb = m[nb, qb1];
"Total Multiplicity"
tm = ma*mb