MathGroup Archive 2002

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

Search the Archive

HELP! Strange evaluations

  • To: mathgroup at
  • Subject: [mg33578] HELP! Strange evaluations
  • From: "Lawrence A. Walker Jr." <lwalker701_remove_ at>
  • Date: Mon, 1 Apr 2002 02:02:12 -0500 (EST)
  • Organization: Morgan State University, COMSARE
  • Sender: owner-wri-mathgroup at


For the life of me I can't figure out how to get the following to work 
correctly.  I also tried using various combinations of Hold and Evaluate 
-- but to no avail.

<< Statistics`NonlinearFit`

(* This works ok *)
goo[a_, b_] :=
   FindRoot[( Cos[a x]) == b x, {x, 0}][[1, 2]];

(* Here are some sample data *)
data = Table[{i, goo[i, .5]}, {i, 0, 1, .2}];

(* This doesn't work -- I expect b->.5 to be returned. *)
BestFitParameters /.
   NonlinearRegress[data, goo[a, b], a, {b, {0., 1.}},
      RegressionReport -> BestFitParameters]

After executing the above, I get the following error messages:

FindRoot::frnum: Function {0. b+Cos[0. a]} is not a length 1 list of 
numbers at {x} = {0.}.

NonlinearRegress::nonnum: The model is not numerical at {b->0., a->0.}. 
  Check that all model parameters are included in the parameter list...

How do I get the above to work.

  • Prev by Date: RE: How to find and plot real roots?
  • Next by Date: Re: UNIX version vs Mac/Win/Linux version
  • Previous by thread: Re: Re: Mathematica & MS Word
  • Next by thread: Re: HELP! Strange evaluations