Re: NMaximize woes

*To*: mathgroup at smc.vnet.net*Subject*: [mg51819] Re: [mg51804] NMaximize woes*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Wed, 3 Nov 2004 01:23:39 -0500 (EST)*References*: <200411020706.CAA21715@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

You do not provide enough code to be sure. However, try changing your deinition of FindQuality to FindQuality[LoopVar_?NumericQ, Imax_??NumericQ]:= ... and see if it works better now. Andrzej Kozlowski Andrzej Kozlowski Chiba, Japan http://www.akikoz.net/~andrzej/ http://www.mimuw.edu.pl/~akoz/ On 2 Nov 2004, at 16:06, 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 ! > >

**References**:**NMaximize woes***From:*"Nix N. Nix" <nix@shaw.ca>