Say I have these data:
data = {{1, 3}, {2, 4}, {3, 6}, {4, 7}};
I want to fit these data with a quadratic equation, like this:
Fit[data, {1, x}, x]
Mathematica then outputs $1.5 + 1.4x$. However, trying to plot this like this:
Plot[Fit[data, {1, x}, x], {x, 0, 5}]
Results in the errors
General::ivar: 0.00010214285714285715` is not a valid variable.
General::ivar: 0.00010214285714285715` is not a valid variable.
General::ivar: 0.10214295918367347` is not a valid variable.
General::stop: Further output of General::ivar will be suppressed during this calculation.
I tried copying the $1.5 + 1.4x$ directly into Plot
, after which I saw that it did not actually say $1.5 + 1.4x$:
Plot[1.5000000000000009` + 1.3999999999999995` x, {x, 0, 5}]
So that's where the ` came from. Surely removing them manually is not the way to go. What went wrong?