I was trying to fit a powerlaw to some data and noticed some inconsistency in the behaviour of mathematica.
This works
{1, 2, 3, 4, 5} // Fit[#, {1, Log[r]}, Log[r]] & // Exp
(* r *)
whereas this does not
{1, 2, 3, 4, 5} // Fit[#, {1, Log10[r]}, Log10[r]] & // 10^# &
While I understand the logic, it seems it represents some level of inconsistency between the way the variables are handled by
Fit
?
a[1]
is generally allowed to be considered a "variable" in functions like these—Log[r]
just happens to be of the same form. Its "meaning" as a logarithm isn't seen byFit
. (However,Log10[r]
immediately evaluates toLog[r]/Log[10]
, and so is not recognized as a variable.) $\endgroup$