Re: Subtle but nasty problem with NMaximize
- To: mathgroup at smc.vnet.net
- Subject: [mg94368] Re: Subtle but nasty problem with NMaximize
- From: Hannes Kessler <HannesKessler at hushmail.com>
- Date: Thu, 11 Dec 2008 03:45:49 -0500 (EST)
- References: <ghj00i$fe4$1@smc.vnet.net> <gho36v$4d$1@smc.vnet.net>
Thank you to all for the information. I use Mathematica 6.03, but good
to know that the error is eliminated in version 7.0
Best regards,
Hannes Kessler
On 10 Dez., 10:47, dh <d... at metrohm.com> wrote:
> Hello Hannes,
>
> this is a problem in version 6 that has been fixed in 7.
>
> hope this helps, Daniel
>
> 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.
>
> > Best regards,
> > Hannes Kessler