I have the following strange situation.

I generate a table

Table1[a_,b_]:=Table[{a, b,0.01*i,function[a,b,0.01*i]},{i,0,20,1}]

Here function[a,b,0.01*i] involves complicated numeric integration. Then I choose particular values of parameters a and b and wait for the table to be generated. It turns out that it's stuck.

However, when I try to display in separate strings all possible values of function for all particular i (i.e., just call the function with the given a, b, i), it turns out that it works perfectly (and just requires some amount of time), with finite total time of evaluation.

What can be a reason for this issue?

  • $\begingroup$ Could be that Table effectively uses Block...but hard to say without knowing function. -- Or put another way, problems with code usually require the code for meaningful answers. $\endgroup$ – Michael E2 Oct 10 '18 at 10:11
  • $\begingroup$ @MichaelE2: the code is long and complicated, involving external files, and unfortunately it is very inconvenient to paste it here. Could you please tell me how to check whether the table uses Block? $\endgroup$ – John Taylor Oct 11 '18 at 15:46
  • $\begingroup$ Table does use Block ("effectively" according to the docs). Check if the code function calls uses a global variable i. It could also be how you call Table[a, b]. Maybe you should use the pattern check ?NumericQ on the arguments a_ and b_. Unhappy families are unhappy in their own way, as Tolstoy said. It's often true of code, too. $\endgroup$ – Michael E2 Oct 11 '18 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.