MathGroup Archive 2004

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

Search the Archive

Re: NMaximize woes

  • To: mathgroup at
  • Subject: [mg52014] Re: NMaximize woes
  • From: David Bailey <dave at>
  • Date: Sun, 7 Nov 2004 01:03:35 -0500 (EST)
  • References: <cm7d2r$liq$>
  • Sender: owner-wri-mathgroup at

Nix N. Nix wrote:
> Hi!
> I'm sorry if this is a repost - I don't think my previous message got 
> posted, but it may have been.
> I have a function called FindQuality which takes two real values and 
> outputs a single real value.  It is a complex collection of loops 
> (things are iterated until convergence) and includes an integral that 
> cannot be evaluated analytically.
> When I try running it through NMaximize, I get the following error:
> NIntegrate::inum: Integrand T1[Enr] T2[Enr,(0.y)/(x^2)] 
> Log[(1+e^((U-Enr)/(k_b*T)))/(1+e^((U-Enr-eV)/(k_B*T)))]
> Except for Enr, which is the variable being integrated over, x, and y, 
> all other variables are constants.
> NMaximize is called as follows:
> NMaximize[{FindQuality[x,y],GStart <= x <= GEnd,CStart <= y <= CEnd},{x,y}]
> FindQuality is defined (partially) as follows:
> FindQuality[LoopVar_, Imax_] := (
>      Print[LoopVar, " " , Imax];
> ...
> As you can see from the error message, the symbols "x" and "y" make it 
> all the way into the integrand.
> The Print statement also outputs "x y".
> Why does NMaximize pass symbols(?) into FindQuality rather than floating 
> point values ? I mean, no wonder the function doesn't work ! Or, am I 
> completely wrong ? Shouldn't the Print statement print out two floating 
> point values instead of two letters I passed into it anyway ?
> I would appreciate any help you can give me !
> Thanks !
As others have said, you may need to supply more information on this 
one, however, I notice 'variables' like k_b and k_B in the expression 
being printed out as part of the diagnostic. You can't use and 
underscore in a variable name because it denotes a pattern.

I suggest you correct this and try again.

David Bailey

  • Prev by Date: Re: Re: Re: Counting Runs
  • Next by Date: Re: MathGroup /: Descriptive headings
  • Previous by thread: Re: NMaximize woes
  • Next by thread: IEEE single precision number.