You can just make f
a function of x
in the first place.
f[x_] = Fit[dp, {1, x, x^2, x^3, x^4, x^5, x^6, x^7}, x]
f[3]
DownValues@f
71.121 - 1.29633 x + 1.34837 x^2 - 0.504693 x^3 + 0.0700859 x^4 - 0.00447611 x^5 + 0.000134178 x^6 - 1.53469*10^-6 x^7
70.4244
{HoldPattern[f[x_]] :> 71.121 - 1.29633 x + 1.34837 x^2 - 0.504693 x^3 + 0.0700859 x^4 - 0.00447611 x^5 + 0.000134178 x^6 - 1.53469*10^-6 x^7}
Also, I guess to actually answer your question of why it happened...It's because you were setting f
as the polynomial expression itself, rather than a function of x
. One could alternatively do
f = Fit[dp, {1, x, x^2, x^3, x^4, x^5, x^6, x^7}, x]
f /. x -> 3
71.121 - 1.29633 x + 1.34837 x^2 - 0.504693 x^3 + 0.0700859 x^4 - 0.00447611 x^5 + 0.000134178 x^6 - 1.53469*10^-6 x^7
70.4244
Or even
f = Function[x, Evaluate@Fit[dp, {1, x, x^2, x^3, x^4, x^5, x^6, x^7}, x]]
f[3]
Function[x, 71.121 - 1.29633 x + 1.34837 x^2 - 0.504693 x^3 + 0.0700859 x^4 - 0.00447611 x^5 + 0.000134178 x^6 - 1.53469*10^-6 x^7]
70.4244