Skip to main content
added 7 characters in body; edited title
Source Link
Alrubaie
  • 1.1k
  • 6
  • 14

find in list almost equal elements, make new list correspond to position or some list

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

find in list equal elements, make new list correspond to position or some list

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 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

find in list almost equal elements, make new list correspond to position or some list

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
Many grammatical errors. Trying to make sense of it.
Source Link

find in list almost equal elements, make new list correspond to position or some list

iI have a list of elements tmcalled q and wish to compute Total Multiplicity of each element, and put these values in the list tm.

iI need to search for equal elements, then list them as a new list with thereeach element's position.

This new list would becontain several lists, because there'sthere are many elements that are equal relativelyrelative to each other.

ExampleHere 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: Look at the last line tmwhere 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

find in list almost equal elements, make new list correspond to position or some list

i have list of elements tm.

i need to search for equal elements, then list them as new list with there position.

This new list would be several, because there's many elements are equal relatively to each other.

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 last line tm.

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

find in list equal elements, make new list correspond to position or some list

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 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
better tagging
Link
Alrubaie
  • 1.1k
  • 6
  • 14

find in list almost equal elements, make new list correspond to position or some list

Source Link
Alrubaie
  • 1.1k
  • 6
  • 14
Loading