MathGroup Archive 2002

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

Search the Archive

Re: Is it possible to access internal variables?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34709] Re: [mg34705] Is it possible to access internal variables?
  • From: BobHanlon at aol.com
  • Date: Sun, 2 Jun 2002 01:14:45 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

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?
>

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

g[x_] := Module[{t = f[x]}, v=Append[v, {x,t}]; t];

g is the same function as f except that calls to g are recorded in v

v={}; FindMinimum[g[x], {x, 2}]

{-0.25, {x -> 3.5}}

FindMinimum called g at the following values of x:

v[[All,1]]

{2., 2., 2.0313609375, 2.0507430627940644,
 
  2.1864179398525154, 3.136142079261673, 3.500000000000001,
 
  3.838316500294484, 3.5, 3.3180710396308366,
 
  3.4999904004703097, 3.5, 3.499999994722301}


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: Package problem
  • Next by Date: Re: Re: Function as an argument of the function
  • Previous by thread: Is it possible to access internal variables?
  • Next by thread: RE: Re: Is it possible to access internal variables?