MathGroup Archive 2008

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

Search the Archive

Re: Another problem with FindMinimum

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90615] Re: Another problem with FindMinimum
  • From: dh <dh at metrohm.ch>
  • Date: Wed, 16 Jul 2008 06:28:57 -0400 (EDT)
  • References: <g5htg1$j8g$1@smc.vnet.net>


Hi,

the gradient function must be a function that gets a vector of numbers 

and must return a vector of numbers. What you do inside the function is 

of no concern to FindMinimum. Therefore, your problem seems to be how to 

define the gradient function. To help you with this, you need to give 

more details.

Daniel





pratip wrote:

> Hi All,

> I am minimizing a function like

> MinFun[a_?(VectorQ[#,NumericQ]&)]

> and I am supplying a gradient like

> GradFun[a_?(VectorQ[#,NumericQ]&)]

> Hence a={a1,a2,..,ak}

> but the code which is used to compute the gradient needs the value of a both symbolically (e.g in order to do some symbolic differentiation) as well as numerically. When I am calling this gradeint function with in FindMinimum it can not retrive the variables i.e a1,a2,..,ak symbolically only they are replaced by their numerical values. But the function GradFun needs "a" symbolically and its updated numerical values in each iteration to compute the derivative.

> If I use GradFun[a_?VectorQ] then symbols are there but numerical values are gone. FindMinimum tells something like

> 

> FindMinimum::nrgnum: "The gradient is not a vector of real numbers at {a,b} = {-2.1,2.}."

> 

> Do I need to use Hold or something like that?

> I hope this is very basic question and you guys will have a answer.

> 





-- 



Daniel Huber

Metrohm Ltd.

Oberdorfstr. 68

CH-9100 Herisau

Tel. +41 71 353 8585, Fax +41 71 353 8907

E-Mail:<mailto:dh at metrohm.com>

Internet:<http://www.metrohm.com>




  • Prev by Date: Re: import FortranForm back
  • Next by Date: Re: A NDSolve within a FindMinimum/NMinimize
  • Previous by thread: Another problem with FindMinimum
  • Next by thread: NIntegrate Confusion