I want to replicate logical operations using standard function definitions. I found that the logical operation
def g(x):
if x == d:
return a
else:
return b
can evaluate to:
$$g(x) = \left|\frac{|x^2-2dx+d^2-\epsilon^2|}{x^2-2dx+d^2-\epsilon^2}-1\right|*\frac{a-b}{2}+b$$ *given $\epsilon$ is an infinitesimally small number.
This epsilon is the reason why my function above fails at using concepts only of standard function definitions. Is there a way to recreate these logical operations without resorting to such?