MathGroup Archive 2008

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

Search the Archive

Another problem with FindMinimum

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90590] Another problem with FindMinimum
  • From: pratip <pratip.official at gmail.com>
  • Date: Tue, 15 Jul 2008 06:16:11 -0400 (EDT)

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.


  • Prev by Date: Re: From 3D to 2D
  • Next by Date: Re: Wacky Font Substitution in .eps Export
  • Previous by thread: Comparison of Mathematica on Various Computers
  • Next by thread: Re: Another problem with FindMinimum