MathGroup Archive 1997

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

Search the Archive

Re: FindMinimum on a potentially Complex-valued function

  • To: mathgroup at
  • Subject: [mg8783] Re: FindMinimum on a potentially Complex-valued function
  • From: Paul Abbott <paul at>
  • Date: Thu, 25 Sep 1997 12:26:17 -0400
  • Organization: University of Western Australia
  • Sender: owner-wri-mathgroup at

Luci Ellis wrote:

> I have recently written a function that involves minimizing a
> log-likelihood function. The function to be minimised is the log of an ugly
> high-order polynomial in three variables.
> It works as expected for some data, but for other data sets, the
> FindMinimum function ends up going to parameters that give complex-number
> values of the objective function, and I get an error. (This also happens in
> Gauss so it's not just a Mathematica problem).
> Is there some way of telling the FindMinimum function that if it hits
> parameter values that give complex-valued results, it should move to some
> other initial guesses for the FindMinimum and try again?

FindMinumum has a 4 parameter calling-sequence, 


which stops searching if x gets outside the range {xmin, xmax}.
> eg, something like:   If[FindMinimum[expr,{a,a0},{b,b0}]==Message[whatever
> the name of the message that comes up
> is],FindMinimum[expr,{a,a0+1},{b,b0+1}],FindMinimum[expr,{a,a0},{b,b0}]]
> And presumably put it in a While Loop, to keep progressively trying
> starting values until it stops falling off the real line.

Can you not modify expr so that it includes a Throw and use an enclosing
Catch?  See section 2.5.9 of the Mathematica book.


Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia           
Nedlands WA  6907                     mailto:paul at 

            God IS a weakly left-handed dice player

  • Prev by Date: Re: Q - image processing / reading TIFF/JPEG files?
  • Next by Date: Re: [Q] Why Integrate[1/x,x] <> Log[Abs[x]] with Mma 2.2 ?
  • Previous by thread: Re: FindMinimum on a potentially Complex-valued function
  • Next by thread: Sound Recording