Create a simple expression that is larger than zero if and only if a-b > 0 and c-d < 0

34 Views Asked by At

Ok, this is simple but I cant figure out a solution to it.

I have four signals, a, b, c, d. I want to generate a signal when a-b > 0 and c-d < 0. This signal should be in the form of an algebraic expression containing a, b, c, d that evaluates to smaller than 0 when (a-b > 0 and c-d > 0 ) is false and bigger than 0 when it is true.

In my ignorance, I thought I just had to multiply -(a-b) and (c-d) and it would be positive when prerequisite was true and negative otherwise. But this didn't work out as the condition a-b < 0 and c-d > 0 also evaluates to positive. I still feel it should be possible to create such an expression using only +, - and *.

No floor(a), round(a) or heaviside(a-b) functions. It has to be only algebraic expression. Stuff like (a-b)*(a-b)+(c-d) is fine.

1

There are 1 best solutions below

0
On

With only +, - and * you get an analytic function. The zero-set of an analytic function can't have a 90 degree corner.

But you could try $-a + b + c - d + \sqrt{(a - b + c - d)^2}$