Transformation to avoid division by 0

1.4k Views Asked by At

I want to model the relationship between a discrete variable $A$ with values in the range $[-5,5]$ and a continuous variable $B$ as $\dfrac A B$.

How do I transform the data to avoid dividing by $0$? I read that one way is to add a small variable epsilon to both variables?

1

There are 1 best solutions below

6
On BEST ANSWER

It looks to me like you want to modify $B$ when it comes close to $0$.

In gnuplot I could do it like this

eps = 0.1

b(x) = abs(x) < eps ? eps : x

where I defined it to be constant $\epsilon \gt 0$ close to $0$.

fear of the null

That means of course that you have at least "arithmetic if" available in your function specification language.