Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Is it possible to access internal variables? [CompoundExpression]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34807] Re: Is it possible to access internal variables? [CompoundExpression]
  • From: "Carl K. Woll" <carlw at u.washington.edu>
  • Date: Sat, 8 Jun 2002 05:21:13 -0400 (EDT)
  • References: <adpfkv$j4f$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Arny (and others),

Concerning your original question, you can do what you want as follows:

First give Message a new definition for the case you are interested in:

In[20]:=
Unprotect[Message];
Message[FindMinimum::"regex",a__/;messageflag]:=
    Module[{},
        messageflag=False;
        If[ValueQ[messlist],messlist={messlist,{a}},messlist={a}];
        Message[FindMinimum::"regex",a];
        messageflag=True;]
Protect[Message];

Now, to see the above in action, consider the example Bob Hanlon came up
with.

In[10]:=
f[x_]:=(x-3)(x-4)

In[15]:=
messageflag=True;
Clear[messlist]
FindMinimum[f[x],{x,2,1,3}]
messageflag=False;
FindMinimum::regex: Reached the point {3.5} which is outside the region
{{1., 3.}}.
FindMinimum::regex: Reached the point {3.5} which is outside the region
{{1., 3.}}.
Out[17]=
FindMinimum[f[x], {x, 2, 1, 3}]

Now, let's see if messlist has the desired information:

In[19]:=
messlist
Out[19]=
{{{3.5}, {{1., 3.}}}, {{3.5}, {{1., 3.}}}}

There you go.

Carl Woll
Physics Dept
U of Washington

In a message dated 6/1/02 6:18:58 AM, someone at somewhere.sometime writes:

>I am minimizing a function which only has real values between 1 and -1,
>most
>of the time... occasionally its range is different and unknown, (but anyway
>not far from 1 and -1).  I could write a routine using Check to catch
errors
>and then expand the range over which FindMinimum is allowed to search,
>but
>since FindMinimum seems to be getting the appropriate values anyway - it
>tells me the values in its error message -  I was wondering if there
weren't
>some way to get at those values and use them without bothering to write
>said routine.  I was thinking of analysing 'MessageList' or '$MessageList',
>but was thinking there might be some easier way.
>
>Aren't variables within packages accessible via their long names, e.g.
>`package`private`variablename or something like that?  Does anyone have
>any suggestions?
>





  • Prev by Date: Re: Problem with hypergeometric function
  • Next by Date: Re: Is it possible to access internal variables?
  • Previous by thread: Re: Is it possible to access internal variables? [CompoundExpression]
  • Next by thread: Re: Is it possible to access internal variables? [CompoundExpression]