A NDSolve within a FindMinimum/NMinimize

*To*: mathgroup at smc.vnet.net*Subject*: [mg90588] A NDSolve within a FindMinimum/NMinimize*From*: philip.ingrey at googlemail.com*Date*: Tue, 15 Jul 2008 06:15:49 -0400 (EDT)

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