how use NDSolve with an ODE having parameters
- To: mathgroup at smc.vnet.net
- Subject: [mg39691] how use NDSolve with an ODE having parameters
- From: Murray Eisenberg <murraye at attbi.com>
- Date: Sat, 1 Mar 2003 22:05:27 -0500 (EST)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- Reply-to: murray at math.umass.edu
- Sender: owner-wri-mathgroup at wolfram.com
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