I want Mathematica to generate a table, but I am very confused by its behaviour.
tab = Table[i, {i, 6.311, 6.312, 0.001}]
Now I get the desired result, namely {6.311, 6.312}.
But in my actual code I want to solve a differential equation for different values of i to a very high precision. But when I do this
tab = Table[i, {i, 6.311`30, 6.312`30, 0.001`30}]
The result that I get is {6.31100000000000000000000000000}, so only 1 value instead of two.
But this
tab = Table[i, {i, 6.311`40, 6.312`40, 0.001`40}]
Gives the desired result again, namely {6.311000000000000000000000000000000000000,
6.312000000000000000000000000000000000000}.
I really have no clue what is happening, and I hope someone could enlighten me because I have been breaking my head about it.
Range[6.311`30, 6.312`30, 0.001`30]
.) $\endgroup$tab = Table[i, {i, 6311/1000, 6312/1000, 1/1000}]
$\endgroup$Table
usually seems to compare with tolerance at the end point (e.g.Table[i, {i, 0, 3, 3*0.1}]
, even though3 * 0.1
is a bit greater than0.3
and the table end a bit past3.
) $\endgroup$Table[..., {i, Subdivide[a, b, n]}]
. $\endgroup$