Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Keeping global parameters in an evaluated function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113251] Keeping global parameters in an evaluated function
  • From: Davide Mancusi <d.mancusi at ulg.ac.be>
  • Date: Wed, 20 Oct 2010 04:10:08 -0400 (EDT)

Hello everyone,

I have a function that depends on some variables and a parameter (say
c). My goal is to find the global minimum of the function for a given
value of the parameter, say c=0. However, the function has a lot of
local minima for c=0, and is thus very difficult to hit the global
one. For c=1, however, the function is much smoother, and the
minimization algorithms work pretty well.

What I'm trying to do is to change the value of the parameter
continuously while Mathematica minimizes the function. By doing so I
hope to trap the minimization algorithms close to the global minimum
using the smooth version of the function, and then slowly let c go to
0.

I have come up with the following toy model (I use NMinimize in the
real problem, but that shouldn't be important):
  f[x_] := (x - c)^4
  c=1;
  iterations=1;
  FindMinimum[ f[x], {x, 1001}, StepMonitor :> {c = c/2; iterations+
+} ]
  Print[{c // N,iterations}]
If I run this I get
  {4.48416*10^-32, {x -> 1.}}
  {1.45519*10^-11,37}
The algorithm finds the minimum at x==1 while I would like it to find
it close to 1.45519*10^-11.

I think the problem lies in the fact that f[x] is evaluated only once,
at the beginning of the minimization algorithm, and the global value
of c gets substituted. Thus, even if I change c later, that doesn't
affect the function being minimized.

Can anyone suggest a way to update c from within the minimization
routine?

Thanks in advance,
Davide


  • Prev by Date: Re: Sin*Cos + Log
  • Next by Date: Re: Is this a bug in NSolve in mathematica?
  • Previous by thread: Re: Interpolation undocumented error
  • Next by thread: Re: Keeping global parameters in an evaluated function