[SciPy-user] optimize.fmin_cg

Mathias Wagner mathias.wagner@physik.tu-darmstadt...
Tue Mar 6 08:45:18 CST 2007


Hi,

potstmu is a scalar function. The optimization works, it is just that the 
output is not

array([xmin]) 

as expect and also works for a scalar function that is optimized with respect 
to a n-dimensional (n>1) argument. In this case the result is

array([xmin0,xmin1,...])

I will try to find a simple example for which I can also post the function I 
want to minimize.

Mathias


On Tuesday 06 March 2007 15:32, you wrote:
> Mathias Wagner wrote:
> > Hi,
> >
> > I use optimize.fmin_cg to find the minimum of 1-dimensional and
> > n-dimensional functions.
> >
> > For 1-dimensional functions everything is fine, but for n-dimensional
> > functions I get a strange result.
> >
> > The function returns an array-of-array-of-arry depending on the number of
> > iterations, for example I get
> >
> > In [6]:scipy.optimize.fmin_ncg(a.potstmu, [60.0] ,
> > a.grad_potstmu,args=(10,0,0),disp=1)
> > Optimization terminated successfully.
> >          Current function value: -3464534650.284432
> >          Iterations: 3
> >          Function evaluations: 51
> >          Gradient evaluations: 9
> >          Hessian evaluations: 0
> > Out[6]:array([[[[[[[[[[[ 121.31834513]]]]]]]]]]])
> >
> >
> > The function potstmu is quite complicated, I am still searching for an
> > easier example which needs more than 1 iteration.
> > Can anyone confirm this behavior?
> > Or is it a problem with my function?
> >
> >
> > Mathias
> > _______________________________________________
> > SciPy-user mailing list
> > SciPy-user@scipy.org
> > http://projects.scipy.org/mailman/listinfo/scipy-user
>
> Hi Mathias,
>
> Maybe I am missing something, but you can't optimize vector valued
> functions.
>
> For example you can optimize the Rayleigh quotient
>
> R(v) = dot(v.T,A*v)/dot(v.T,B*v)  \quad    R \in \mathds{R},\quad v \in
> \mathds{R}^n
>
> where v is a vector. Please can you expand on your function potstmu.
>
> Nils

-- 
// ***************************************************************
// ** Mathias Wagner                                            **
// ** Institut fuer Kernphysik, TU Darmstadt                    **
// ** Schlossgartenstr. 9, 64289 Darmstadt, Germany             **
// **                                                           **
// ** email: mathias.wagner@physik.tu-darmstadt.de              **
// ** www  : http://crunch.ikp.physik.tu-darmstadt.de/~wagner   **
// ***************************************************************


More information about the SciPy-user mailing list