I apply the following command:
Do[Print[var[u] = u], {u, -1, 1, 0.1}]
It produces out put. But when i recall the value var[-0.4] as below:
In[2]:= var[-0.4]
Out[2]= var[-0.4]
It produces var[-0.4] instead of the value. It can be handled if i replace step size 0.1 by 1/10 but i want to work with decimal point form. It may be due to floating point. If any one may help to give a good suggestion on it. It will be highluy appreciated.
varto handle inexact numbers:Do[var[u] = u, {u, -1, 1, 1/10}]; var[r_Real] := var[Rationalize[r]]– Mr.Wizard Dec 21 '16 at 04:26