0
|
3694 Views
|
|
0 Total Likes
View groups...
Share
GROUPS:

# FindFit function question on NormFunction option

Posted 10 years ago
 Hello everybody i need a little help. When i am using "FindFit" function on mathematica, i want to set a "NormFunction" and use my own norm. The question is mathematica has only 3 examples (1-norm, 2-norm and infinite-norm) about that and how can i find more examples? i looked almost all "help" documents but can't find anything. Can anyone show me some examples or any information about how to do ?you can find me from https://www.facebook.com/aiqut
Sort By:
Posted 10 years ago
 You need to write your own NormFunction as a "pure" function.  For example In[1]:= data = Table[Prime[x], {x, 20}]  Out[1]= {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, \ 59, 61, 67, 71}  In[2]:= FindFit[data, a x Log[b + c x], {a, b, c}, x]  Out[2]= {a -> 1.42076, b -> 1.65558, c -> 0.534645} In[5]:= FindFit[data, a x Log[b + c x], {a, b, c}, x, NormFunction -> (Sqrt[#.#] &)]During evaluation of In[5]:= FindFit::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the norm of the residual. You may need more than MachinePrecision digits of working precision to meet these tolerances. >>Out[5]= {a -> 1.42075, b -> 1.65558, c -> 0.534649}For the evaluation In[5], I wrote my own NormFunction
Community posts can be styled and formatted using the Markdown syntax.