MathGroup Archive 2000

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

Search the Archive

Re: Gradient in FindMininum

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24039] Re: Gradient in FindMininum
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 21 Jun 2000 02:20:01 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <8in56l$44a@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

a) with

f[x_] := x^2 + NIntegrate[Exp[-t^2], {t, -Infinity, x}]
FindMinimum[f[x], {x, -2, 2}]

I got 

{0.666069, {x -> -0.419364}}
with out an error message. Just use two values.

b) Is it so hard to compute D[Integrate[g[t],{t,-Infinity,x}],x] and
   put it into the Gradient option of FindMinimum[] ?
   (Abramowitz, Stegun, formula 3.3.7 ?) 
   D[#,c]& @ Integrate[f,{x,a,b}]==
    f[b,c]*D[b,c]-f[a,c]*D[a,c]+Integrate[D[f,c],{x,a,b}]
   

Regards
  Jens

Johannes Ludsteck wrote:
> 
> Dear MathGroup Members,
> Unfortunately I got no answer when I sent the question below last
> week to the mathgroup mailing list. Since I think that the problem
> is not a very special one but a general problem of the way how
> Mathematica treats numerical integrals in the computation of
> gradients, I retry to get an answer.
> I want to minimize a complicated function which contains
> numerical integrals. Since the function is too complicated for a
> direct demonstration, I give a simple example which makes the
> structure of the problem clear:
> 
> The (example) function to be minimized is:
> f[x_] := NIntegrate[g[t], {t, -Infinity, x}]
> 
> (g is a known function; however symbolical integration is
> impossible).
> 
> When I request numerical minimization of this function by typing
> 
> FindMinimum[f[x],{x,1}]
> 
> Mathematica gives me the following error message:
> 
> FindMinimum::fmgl: Gradient {Indeterminate} is not a length 1
> list of real numbers at {x} = {1.}.
> 
> Appearently, Mathematica is not able to find the gradient
> symbolically. A simple solution would be to define f using Integrate
> (without prefix N) and to wrap it with N[ ]:
> 
> f[x_]:= N[  Integrate[g[t], {t,-Infinity, x}] ]
> 
> However, since the function contains some hundred terms,
> evaluation of the function takes several minutes. (Mathematica then
> tries to find the integral symbolically before applying the numerical
> integration procedure.) This makes optimization impracticable.
> (the function I want to optimize has about 40 variables!).
> 
> Are there any suggestions how to avoid computation of the gradient
> manually? (minimization algorithms which don't use the gradient
> are impracticable.)
> I.e. how can I tell Mathematica to use the first definition
> 
> f[x_] := NIntegrate[g[t], {t, -Infinity, x}]
> 
> for evaluation of the function and the second
> 
> f[x_]:= N[ Integrate[g[t], {t,-Infinity, x}] ]
> 
> for the computation of the gradient.
> 
> Thank you
> 
> P.S If you want to reproduce the error message, you can use a
> simple definition:
> 
> f[x_]:= x^2 + NIntegrate[ Exp[-t^2], {t, -Infinity, x} ].
> 
> Johannes Ludsteck
> Centre for European Economic Research (ZEW)
> Department of Labour Economics,
> Human Resources and Social Policy
> Phone (+49)(0)621/1235-157
> Fax (+49)(0)621/1235-225
> 
> P.O.Box 103443
> D-68034 Mannheim
> GERMANY
> 
> Email: ludsteck at zew.de


  • Prev by Date: Re: imposing side conditions on Solve
  • Next by Date: RE: Gradient in FindMininum
  • Previous by thread: Re: Gradient in FindMininum
  • Next by thread: RE: Gradient in FindMininum