Re: Subtle but nasty problem with NMaximize
- To: mathgroup at smc.vnet.net
- Subject: [mg94247] Re: [mg94218] Subtle but nasty problem with NMaximize
- From: Brett Champion <brettc at wolfram.com>
- Date: Tue, 9 Dec 2008 06:56:25 -0500 (EST)
- References: <200812081121.GAA15815@smc.vnet.net>
On Dec 8, 2008, at 5:21 AM , Hannes Kessler wrote:
> Dear all,
>
> the following example returns $Failed without printing actually any
> messages:
>
> data = Map[Function[x, {x, Sin[x]}], Range[0, Pi, Pi/4]];
> ipol = Interpolation[data];
> Check[NMaximize[{ipol[x], 0 <= x <= Pi}, {x}],$Failed]
>
> whereas omitting Check[ ..., $Failed] returns the correct answer {1.,
> {x -> 1.5708}}.
>
> This nasty $Failed causes to fail one of my packages where I use
> Catch @ Module[{...},
> ...
> Check[..., Throw @ Message[...];
> ...]
>
> to locate run time errors. I would appreciate very much suggestions
> for a work around or an explanation why $Failed is returned.
What version of Mathematica are you using?
Brett Champion
Wolfram Research
- References:
- Subtle but nasty problem with NMaximize
- From: Hannes Kessler <HannesKessler@hushmail.com>
- Subtle but nasty problem with NMaximize