NonlinearRegress and numerical functions...

*To*: mathgroup at smc.vnet.net*Subject*: [mg20161] NonlinearRegress and numerical functions...*From*: Lars Ragnarsson <loke at ic.chalmers.se>*Date*: Sun, 3 Oct 1999 21:07:33 -0400*Organization*: Chalmers University of Technology*Sender*: owner-wri-mathgroup at wolfram.com

Hi I've got a big problem making Mathematica realize that my function is numerical. The following problem illustrates it in a rather simplified way: g[t1_] := y[t] /. DSolve[{y'[t] == -y[t] 3, y[0] == 6}, y[t], t][[1]] /. t -> t1 data = {0, 10, 20, 100}; fit = Transpose[{data, g[data]}]; f[t1_, a_,b_] := (y[t] /.NDSolve[{y'[t] == -y[t] a, y[0] == b}, y[t], {t, 0, 100}][[1]]) /.t -> t1 NonlinearRegress[data, f[t, a, 6], {t}, {a, {2.9, 3.2}, 2, 4}] It should be rather straightforward to solve this, but NonlinearRegress seem to evaluate the function 'f' first and the results: NDSolve::"ndnum": "Encountered non-numerical value for a derivative at \ \!\(t\) == \!\(2.680466916142905`*^-274\)." etc.... I've tried to use Unevaluated and Hold but nothing works! Any help would be greatly appreciated! Regards Larske Ragnarsson _________________________________________________ Larske Ragnarsson Phone: +46 (0)31 7721867 Fax: +46 (0)31 7723622 Chalmers University of Technology Solid State Electronics Laboratory Department of Microelectronics ED S-412 96 Guteborg, SWEDEN _________________________________________________

**Follow-Ups**:**Re: NonlinearRegress and numerical functions...***From:*Daniel Lichtblau <danl@wolfram.com>