Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

NonlinearRegress and numerical functions...

  • To: mathgroup at
  • Subject: [mg20161] NonlinearRegress and numerical functions...
  • From: Lars Ragnarsson <loke at>
  • Date: Sun, 3 Oct 1999 21:07:33 -0400
  • Organization: Chalmers University of Technology
  • Sender: owner-wri-mathgroup at


I've got a big problem making Mathematica realize that my function is
numerical. The following problem illustrates it in a rather simplified

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\)."


I've tried to use Unevaluated and Hold but nothing works!

Any help would be greatly appreciated!


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

  • Prev by Date: NonlinearRegress and numerical function
  • Next by Date: Re: unix font problem
  • Previous by thread: Re: NonlinearRegress and numerical functions...
  • Next by thread: Re: NonlinearRegress and numerical functions...