MathGroup Archive 2008

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

Search the Archive

A NDSolve within a FindMinimum/NMinimize


I'm trying to find the value of a coefficient that minimizes a
function. Below is a simplified version of the problem:
Using a Table to print out some results is fine:

Table[{a, s = NDSolve[{El'[x] + a Sin[x] El[x] == 0, El[0] == a}, El,
{x, -1, 1}]; ((El[1] /. s) a)[[1]]}, {a, -1, 1, 0.1}]

But a NMinimize or FindMinimum gives errors:

NMinimize[s = NDSolve[{El'[x] + a Sin[x] El[x] == 0, El[0] == a}, El,
{x, -1, 1}]; (El[1]  /. s) a, a]

As it seams to try and evaluate the NDSolve then apply a value for a,
is there a way to solve this?

Thanks in advance,
Phil I


  • Prev by Date: Re: Mathematica kernel color printing (Linux)
  • Next by Date: WorldPlot, WorldRotation... with a twist?
  • Previous by thread: Re: import FortranForm back
  • Next by thread: Re: A NDSolve within a FindMinimum/NMinimize