MathGroup Archive 1997

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

Search the Archive

Re: Outer solutions of Findminimum

  • To: mathgroup at smc.vnet.net
  • Subject: [mg9871] Re: [mg9845] Outer solutions of Findminimum
  • From: David Withoff <withoff>
  • Date: Sat, 29 Nov 1997 00:11:00 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

> I need a tip on how to grab the value of parameters in a message so that
> the output of these inputs become 0.4 and 0.6 respectively.
>
> In[1]:=Check[FindMinimum[-Sin[Pi x],{x,0,0,0.4}],
> FirstParameterOfMessage,FindMinimum::regex]
>
>
> FindMinimum::regex:
>    Reached the point 0.4 which is outside the region {{0., 0.4}}.
>
> Out[1]=
> FirstParameterOfMessage
>
> In[2]:=
> Check[FindMinimum[-Sin[Pi
> x],{x,0.7,0.6,1}],FirstParameterOfMessage,FindMinimum::regex]
>
> FindMinimum::regex:
>    Reached the point 0.6 which is outside the region {{0.6, 1.}}.
>
> Out[2]=
> FirstParameterOfMessage
>
> Helge

You could do this:

In[1]:= Unprotect[Message] ;

In[2]:= Message[_, p_, ___] := Abort[] /; (FirstParameterOfMessage = p;
False)

In[3]:= Check[FindMinimum[-Sin[Pi x],{x,0,0,0.4}],
                      FirstParameterOfMessage,FindMinimum::regex]

FindMinimum::regex:
   Reached the point 0.4 which is outside the region {{0., 0.4}}.

Out[3]= 0.4

In[4]:= Check[FindMinimum[-Sin[Pi x],{x,0.7,0.6,1}],
                      FirstParameterOfMessage,FindMinimum::regex]

FindMinimum::regex:
   Reached the point 0.6 which is outside the region {{0.6, 1.}}.

Out[4]= 0.6

I hope that you will be careful while using an intermediate algorithmic
detail (the value sent to the message) as the final result.

Dave Withoff
Wolfram Research


  • Prev by Date: Re: Problem with ContourPlot
  • Next by Date: Re: RE: Trivial integral freezes 3.
  • Previous by thread: Re: Outer solutions of Findminimum
  • Next by thread: Differential Equations