I am fairly new to Mathematica so I am not really familiar with all the "kinks" in its syntax (a matlab lover). I am trying to run this:
del = 0.01;
L = 15;
Res = ConstantArray[0, {L, L}];
For [i = 1, i <= L, \[Alpha] = i*del,
For[j = 1, F <= L, F = j*del,
q = {\[CurlyEpsilon] -> 0.1, \[Lambda] -> 0.01, \[Omega] -> 1.2};
eqc1 = eqc /. q;
eqs1 = eqs /. q;
sol = FindRoot[{eqc1 == 0, eqs1 == 0}, {{A, 1.6}, {\[Psi], 0}}];
{A, \[Psi]} = {A, \[Psi]} /. sol;
Res[[i, j]] = A;
]
]
eqc and eqs are defined function with parameters listed in list "q", alpha and F. I am sloving for A and psi. outside of a loop, the FindRoot runs for less than a second. when I deifne L=1 (equivillent to a single calculation), the calculation stalls. I do know that for some values of alpha and F, the calculation errors out. What I would like to know is, how can I tell the program to ignore the error and just continue? or even better provide some sort of output into my matrix ("Res") saying that for this combination of parameters there is no solution.
I am sorry for any obvious "Noob" mistakes :)
Thank you very much to all of you!!!
TableorArraypretty much the same as aForloop but creates a matrix with the results:Array[f, {3, 3}]Table[f[i, j], {i, 3}, {j, 3}]– ssch Feb 5 at 11:18Partition[0.1 {First@#, Last@#} & /@ Tuples[Range@15, 2],15]– image_doctor Feb 5 at 12:03qout of the loop at least. You should also check out this question. – Verbeia♦ Feb 6 at 2:29