# How to get numerical results from HeavisideTheta?

I have defined a table tab = {7.52521, 17.0083, 22.5678, 11.8707, 8.27799} and a function F[x_] := tab[[1]]*HeavisideTheta[x] + (tab[[2]] - tab[[1]])* HeavisideTheta[x - 20] + (tab[[3]] - tab[[2]])* HeavisideTheta[x - 40] + (tab[[4]] - tab[[3]])* HeavisideTheta[x - 60] + (tab[[4]] - tab[[5]])* HeavisideTheta[x - 80].

If I now try to look at the value at 20:

In[402]:= F[20]

Out[402]= 7.52521 + 9.48311 HeavisideTheta[0]


But the problem is that I need this result to be numerical, because I want to do some more calculations with it. And it is not numerical, because it is at the border of two Heaviside functions. How do I change my definition of function F in order to get pass that problem? Or maybe is there a different way to get F[20]? It is not very important value of which Heaviside function it takes (to the left or to the right of 20).

• Try replacing HeavisideTheta[] with UnitStep[] for numerical evaluations. Commented Jul 20, 2015 at 13:07

nHeaviside[x_] := If[x < 0, 0, 1]

will work. You can choose which value it will assume at zero by changing the condition to x <= 0. Alterantively, the function Unitstep does a similar task:
nHeaviside2[x_] := UnitStep[x]