I have a huge table of data which I need to insert all of them in my main function using a For loop. For example, I have
subsnum = {{x -> 1., y -> 1.}, {x -> 2., y -> 2.}, {x -> 3.,
y -> 3.}};
FullScalarMasses = {{x^2, y^3}, {x + y, y}};
and I want to calculate the Eigenvalues of "FullScalarMasses" for all elements of "subsnum". The code I use is the following
For[i = 0, i <= 3, i++,
es1 = Eigenvalues[FullScalarMasses //. subsnum[[i]]]]
however I get this error and can't continue:
ReplaceRepeated::reps: {List} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. >>
How can I solve the problem? In practice my code is a lot more complicated than this. I have a big data table with more than a million values, and I need to calculate several things for each element of the table. An the only way I can think of is using "ReplaceRepeated" in a For loop. Is there any other way I can do this?
P.S.: I have to calculate many things in the loop at the same time for the same element, so "Table" is not an option.
Forloop starts ati = 0. Sosubsnum[[i]]evaluates tosubsnum[[0]], which returns the head of the expression,List. Then you have theReplaceRepeatederror. You can start ati = 1to avoid this issue. – Sep 06 '16 at 23:24Foris highly inefficient on Mathematica. I recommendDo, which is a native Mathematica function, with the same functionality as, but with significantly faster evaluation than,For. That is:Do[es1 = Eigenvalues[FullScalarMasses //. subsnum[[i]], {i, 3}]– JungHwan Min Sep 06 '16 at 23:34