From: Xaq Pitkow on
Hello MathGroup,

I'm trying to minimize a function (F[b,J]-1)^2, where the argument b
will itself be determined by another minimization:

F[b_,J_] := b^2 - b*J + J^2
B[J_] := Last[ FindArgMin[ F[b,J] , {b,1.} ] ]

When I try the outer minimization, I run into trouble:

FindMinimum[ b = B[J]; (F[b, J] - 1)^2, {J, -1.}]

gives the error

FindArgMin::nrnum : The function value 1.-1.J+J^2 is not a real
number at {b}={1.}.

In this case I know the right answer, but my real problem is much more
complicated. Here I've isolated the technical Mathematica problem. I'm
guessing that there's some trick to telling the inner minimization how
to localize the variable J. Any suggestions?
Many thanks!
xaq pitkow, center for theoretical neuroscience