---
url: /dyad/stable/stdlib/BlockComponents/components/Math.Sign.md
description: Dyad Math.Sign docs.  Outputs the sign of the input.
---

# `Math.Sign` {#Math.Sign}

Outputs the sign of the input.

Computes the output `y` as the sign of the input `u`:

$$y = \operatorname{sign}(u) = \begin{cases}
1 & \text{if } u > 0 \\
0 & \text{if } u = 0 \\
-1 & \text{if } u < 0
\end{cases}$$

This component extends from [`BlockComponents.Interfaces.SISO`](../types/Interfaces.SISO.md)

## Usage {#Usage}

`BlockComponents.Math.Sign()`

## Connectors {#Connectors}

* `u` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `y` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

## Behavior {#Behavior}

$$ \begin{align}
y\left( t \right) &= sign\left( u\left( t \right) \right)
\end{align}
$$

## Source {#Source}

````dyad
"""
Outputs the sign of the input.

Computes the output `y` as the sign of the input `u`:

```math
y = \operatorname{sign}(u) = \begin{cases}
  1 & \text{if } u > 0 \\
  0 & \text{if } u = 0 \\
 -1 & \text{if } u < 0
\end{cases}
```
"""
component Sign
  extends BlockComponents.Interfaces.SISO
relations
  "Computes the sign of the input signal"
  y = sign(u)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/Sign.svg"}
  }
}
end
````

````dyad
"""
Outputs the sign of the input.

Computes the output `y` as the sign of the input `u`:

```math
y = \operatorname{sign}(u) = \begin{cases}
  1 & \text{if } u > 0 \\
  0 & \text{if } u = 0 \\
 -1 & \text{if } u < 0
\end{cases}
```
"""
component Sign
  "Input signal port"
  u = RealInput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "input", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0},
        "diagram": {"iconName": "input", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0}
      }
    }
  }
  "Output signal port"
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "output", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0},
        "diagram": {"iconName": "output", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      }
    }
  }
relations
  "Computes the sign of the input signal"
  y = sign(u)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/Sign.svg"}
  }
}
end
````

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`Constant`](Math.Sign.md)

  * [`Sign`](Math.Sign.md)

  * [`Sign`](Math.Sign.md)

  * [`Sine`](Math.Sign.md)
