       NMaximize woes

• To: mathgroup at smc.vnet.net
• Subject: [mg51804] NMaximize woes
• From: "Nix N. Nix" <nix at shaw.ca>
• Date: Tue, 2 Nov 2004 02:06:11 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

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