Re: how use NDSolve with an ODE having parameters
- To: mathgroup at smc.vnet.net
- Subject: [mg39710] Re: [mg39691] how use NDSolve with an ODE having parameters
- From: Murray Eisenberg <murraye at attbi.com>
- Date: Mon, 3 Mar 2003 04:25:54 -0500 (EST)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <A9558DE0-4CF7-11D7-BC7C-000393671006@earthlink.net>
- Reply-to: murray at math.umass.edu
- Sender: owner-wri-mathgroup at wolfram.com
Thanks, I'll pass this on to my colleague. Actually, he was hoping to make use of the various information that NonlinearRegress provides with the option RegressionReport. Selwyn Hollis wrote: > Murray, > > I can't get NonlinearRegress to work either, but using FindMinimum on > the least squares error seems to work. Here's the general idea: > > model[x_, a_, b_] := (y /. First@NDSolve[{ your DE, y[0] == initval}, > y, {t, 0, 2}])[x] > > LSE[a_, b_] := Sum[(data[[i, 2]] - model[data[[i, 1]], a, b])^2, {i, > Length[data]}] > > FindMinimum[LSE[a, b], {a, a1, a2}, {b, b1, b2}] > > --- > Selwyn Hollis > > > > On Saturday, March 1, 2003, at 10:05 PM, Murray Eisenberg wrote: > >> This is a simplification of a question asked by a colleage. He wants to >> use as the model function argument to NonlinearRegress (from >> Statistics`NonlinearFit1) a solution of an initial-value problem for a >> differential equation, where the differential equation depends on a >> parameter. >> >> The catch is that the differential equation cannot be solved explicitly, >> so he has to resort to solving the initial-value problem by means of >> NDSolve. Of course, NDSolve will not do anything if the differential >> equation involves symbolic parameters. Thus the IDEA of what he wants >> to do is to use the "resulting function" from something like >> >> y[t]/.First@NDSolve[{y'[t] == a y[t] + b, y[0] == 1.}, y[t], {t, 0., >> 1.}] >> >> -- where two parameters a and b are involved -- as the model. Of >> course if NDSolve above is changed to DSolve, no difficulty. But in >> the ACTUAL >> problem at issue, with a much more complicated differential equation, >> DSolve does nothing. >> >> Is there some way to make this work? >> >> There are evidently two difficulties: >> >> (1) How to deal with NDSolve when the differential equation involves >> parameters (perhaps there's something regarding use of Hold that will >> help?); and >> >> (2) For each pair of particular values of the parameters, the result >> from NDSolve is an InterpolatingPolynomial object and NOT the sort of >> "expression in the variable" that seems to be required for the model >> argument to NonlinearRegress. How should the InterpolatingPolynomial >> object be massaged to allow it to be used as an ordinary expression in >> the variable? >> >> -- >> Murray Eisenberg murray at math.umass.edu >> Mathematics & Statistics Dept. >> Lederle Graduate Research Tower phone 413 549-1020 (H) >> University of Massachusetts 413 545-2859 (W) >> 710 North Pleasant Street >> Amherst, MA 01375 >> >> > > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street Amherst, MA 01375