I'd like to be able to define a sort of ''staircase'' function, which I would write as the following (forgive the bad ASCII, please!):
| 0 if z<0
| 1 if 0<z<d1
| 2 if d1<z<d2
| 3 if d2<z<d3
F[z_]= < .
| p if d(p-1)<z<dp
| p+1 if dp<z
Where the ''d''s are pre-defined, and the value of p (the total number of steps) is changeable, with a value anywhere from 2 to several hundred. I would like to be able to find
F[z] for any random z, and for example be able to plot F[z] vs. z. Also, I need to use F[z] in the definition of other functions that depend on z.
I know that if p is very small (say, 3), I could just use a few nested ''if'' statements. But I would like to be able to readily change the number of steps, and make it quite large. Unfortunately, I am not too familiar with functions much more complicated than, for example, the nested ''if'' statement. And help would be appreciated!!