I defined a function f[x_] = x^3 2 x
. Then I had to construct a table showing vertically, the values of f
corresponding to x on the interval [-3,3] in increment of 0.5.
So, I did this:
f[x_] = x^3 - 2 x;
a := PaddedForm[x, {2, 1}];
b := PaddedForm[f[x], {5, 3}];
p = Table[{a, b}, {x, -3, 3, .5}];
TableForm[p,
TableHeadings -> {None,{"x", "f(x)=x^3-2x"}},
TableAlignments -> Center]
I had my answers and so far it was ok. But next, I had to plot the set of values with heavy dots. So I did this:
ListPlot[p];
But now there's an error saying:
Co-ordinate -3.0 in {-3.0,-21.000} is not a floating-point number ....
How do I fix this?
PaddedForm
wrapper:ListPlot[Table[{x, f@x}, {x, -3, 3, .5}]]
. $\endgroup$