Re: Detecting unsuccessful computations
- To: mathgroup at smc.vnet.net
- Subject: [mg39319] Re: Detecting unsuccessful computations
- From: Mike Yukish <may106 at psu.edu>
- Date: Tue, 11 Feb 2003 04:41:46 -0500 (EST)
- Organization: Penn State University, Center for Academic Computing
- References: <b27fn8$n9t$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Uri Zwick wrote: > Hi, > > Mathematica functions such as LinearSolve, LinearProgramming, > FindMinimum and many others, sometimes cannot perform the > requested task. (The linear system of equations has no solution, the > linear program has no feasible points, etc.) <snip> > > What is the recommended way of calling a function like > LinearProgramming and getting an indication that something > went wrong, WITHOUT getting any error message printed? Had just this problem myself. Solution for me is a two-parter. First, wrap the FindMinimum[ ] code or other in a Check[ ] function, to act on the error. Second, wrap this in a Block that redirects the $Messages pipe temporarily. So you get... Block[{$Messages={}, Check[ FindMinimum[blah, blah, blah], OopsWhatToDoIfAnError[ ] ] ] Read the Mathematica help on $Messages and on Check for more info