0
|
6896 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
GROUPS:

# Add several elements in a list

Posted 9 years ago
 Hi, i am new to Mathematica and would be glad if someone could help me. I am trying to add all elements from the alpha values {a55 to a516) in a new list. The result should always be 1. I am failing to get the relevant values {a55 -> 0., a144 -> 0., a153 -> 0., a444 -> 0., a516 -> 1.}  for example ... thanks in advance Here is a part of my list for better understanding {{588.833, {a55 -> 0., a144 -> 0., a153 -> 0., a444 -> 0., a516 -> 1.}}, {591.623, {a55 -> 0., a144 -> 5.98205*10^-9, a153 -> 0., a444 -> 0., a516 -> 1.}}, {594.522, {a55 -> 3.25107*10^-9, a144 -> 5.49271*10^-9, a153 -> 4.53039*10^-9, a444 -> 2.12099*10^-8, a516 -> 1.}}, {597.534, {a55 -> 8.17124*10^-9, a144 -> 1.48647*10^-8, a153 -> 1.17452*10^-8, a444 -> 6.94263*10^-8, a516 -> 1.}}, {600.662, {a55 -> 2.22368*10^-10, a144 -> 3.86578*10^-10, a153 -> 3.16347*10^-10, a444 -> 1.62874*10^-9, a516 -> 1.}}, {603.913, {a55 -> 5.55368*10^-10, a144 -> 9.54729*10^-10, a153 -> 7.86149*10^-10, a444 -> 3.89039*10^-9, a516 -> 1.}}} 
3 Replies
Sort By:
Posted 9 years ago
 Transpose[{Flatten@data[[All, 2]]}][[All, 1, 2]] // Total
Posted 9 years ago
 thank you very much. That helped! :)
Posted 9 years ago
  (*data={{588.833, {a55 -> 0., a144.....*) Total@Flatten@data[[All, 2]] /. (Rule[x_, y_] :> y) (* 6.333*)