Question: How to force a for loop to continue even when some error occurred in some calculation

Hi,

I am trying to execute a for loop for some repetitive calculation. For eg. i is varying from 1 to 10 and j is varying from 1 to 6. For each combination of i and j, I am computing  value of a function.  I got output for some initial (i,j) pair in for loop. After that, an error encountered and for loop interrupted( stopped). How can I tell maple to continue  for loop even when some error occurred for some combination of (i,j) pair. Maple can discard the output for which an error occurred and can continue the foor loop for the remaining (i,j) pair. For eg.

1) In for loop, I am using NLPSolve command and after giving some initial result it shows-

Error, (in Optimization:-NLPSolve) complex value encountered.

2) Similarly, in for loop, I am using DirectSearch[search] command and after giving some initial result it shows-

Error, (in DirectSearch:-Search) cannot find feasible initial point; specify a new one

Please guide me in this problem..

Thanks and Regards,

Nilesh

Please Wait...