MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Detecting unsuccessful computations


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






  • Prev by Date: Re: Finding multiple roots - RootsInRange.nb (1/1)
  • Next by Date: Re: I need some help about this error
  • Previous by thread: Detecting unsuccessful computations
  • Next by thread: Re: Detecting unsuccessful computations