HELP! Strange evaluations
- To: mathgroup at smc.vnet.net
- Subject: [mg33578] HELP! Strange evaluations
- From: "Lawrence A. Walker Jr." <lwalker701_remove_ at earthlink.net>
- Date: Mon, 1 Apr 2002 02:02:12 -0500 (EST)
- Organization: Morgan State University, COMSARE
- Sender: owner-wri-mathgroup at wolfram.com
Hi, 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.