recategorized by
764 views
0 votes
0 votes

A $\textit{clamp}$ gate is an analog gate parametrized by two real numbers $a$ and $b$, and denoted as $\text{clamp}_{a,b}$. It takes as input two non-negative real numbers $x$ and $y$. Its output is defined as

$$\textit{clamp}_{a,b}(x,y) = \begin{cases}ax+by & \text{when } ax+by\geq 0,\text{ and} \\ 0& \text{ when }  ax + by<0. \end{cases}$$

Consider circuits composed only of clamp gates, possibly parametrized by different pairs $(a,b)$ of real numbers. How many clamp gates are needed to construct a circuit that on input non-negative reals $x$ and $y$ outputs the maximum of $x$ and $y?$

  1. $1$
  2. $2$
  3. $3$
  4. $4$
  5. No circuit composed only of clamp gates can compute the max function
recategorized by

2 Answers

3 votes
3 votes
The answer is option B.

$clamp_{1, 1}(clamp_{1, -1}(x, y), y)$ computes the maximum of $x$ and $y$.

Case 1 : when $x \geq y$

$clamp_{1, -1}(x, y) = x - y$

$clamp_{1, 1}(x-y, y) = x$

Case 2: when $x \lt y$

$clamp_{1, -1}(x, y) = 0$

$clamp_{1, 1}(0, y) = y$
edited by
1 votes
1 votes
$\text{max}(x,y) = \frac{1}{2}(x+y + |x-y|)$

Here, $x\geq0,$$y\geq0$

Now,

Case $1$ : When $x \geq y$

$\text{max}(x,y) = \frac{1}{2}(x+y + x-y) = x = \text{clamp}_{1,0}(x,y)$

Case $2$ : When $x < y$

$\text{max}(x,y) = \frac{1}{2}(x+y + y-x) = y = \text{clamp}_{0,1}(x,y)$

So, we need only $2$ clamp gates as $\text{clamp}_{1,0}(x,y)$ and $\text{clamp}_{0,1}(x,y)$ to find $\text{max}(x,y).$
edited by
Answer:

Related questions

10 votes
10 votes
2 answers
2
makhdoom ghaya asked Oct 17, 2015
1,670 views
Consider the problem of maximizing $x^{2}-2x+5$ such that $0< x< 2$. The value of $x$ at which the maximum is achieved is:$0.5$$1$$1.5$$1.75$None of the above
0 votes
0 votes
2 answers
3