---
url: /dyad/dev/stdlib/BlockComponents/components/Math.Atan2.md
description: Dyad Math.Atan2 docs.  Outputs the four-quadrant arc tangent of the inputs.
---

# `Math.Atan2` {#Math.Atan2}

Outputs the four-quadrant arc tangent of the inputs.

Computes the output `y` as the four-quadrant arc tangent of input `u1` divided by input `u2`:

$$y = \operatorname{atan2}(u_1, u_2)$$

Uses the signs of both `u1` and `u2` to determine the correct quadrant, giving a result in the range \[-π, π]. Both inputs must not be zero at the same time.

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

## Usage {#Usage}

`BlockComponents.Math.Atan2()`

## Connectors {#Connectors}

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

* `u2` - 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) &= \arctan\left( \mathtt{u1}\left( t \right), \mathtt{u2}\left( t \right) \right)
\end{align}
$$

## Source {#Source}

````dyad
"""
Outputs the four-quadrant arc tangent of the inputs.

Computes the output `y` as the four-quadrant arc tangent of input `u1` divided
by input `u2`:

```math
y = \operatorname{atan2}(u_1, u_2)
```

Uses the signs of both `u1` and `u2` to determine the correct quadrant, giving
a result in the range [-π, π]. Both inputs must not be zero at the same time.
"""
component Atan2
  extends BlockComponents.Interfaces.SI2SO(y(units = "rad"))
relations
  "Computes the four-quadrant arc tangent of the two input signals"
  y = atan(u1, u2)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/Atan2.svg"}
  }
}
end
````

````dyad
"""
Outputs the four-quadrant arc tangent of the inputs.

Computes the output `y` as the four-quadrant arc tangent of input `u1` divided
by input `u2`:

```math
y = \operatorname{atan2}(u_1, u_2)
```

Uses the signs of both `u1` and `u2` to determine the correct quadrant, giving
a result in the range [-π, π]. Both inputs must not be zero at the same time.
"""
component Atan2
  "First real-valued input signal"
  u1 = RealInput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": -100, "y1": 150, "x2": 0, "y2": 250, "rot": 0},
        "diagram": {"iconName": "default", "x1": -100, "y1": 150, "x2": 0, "y2": 250, "rot": 0}
      },
      "tags": []
    }
  }
  "Second real-valued input signal"
  u2 = RealInput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": -100, "y1": 750, "x2": 0, "y2": 850, "rot": 0},
        "diagram": {"iconName": "default", "x1": -100, "y1": 750, "x2": 0, "y2": 850, "rot": 0}
      }
    }
  }
  "Real-valued output signal"
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0},
        "diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      }
    }
  }
relations
  "Computes the four-quadrant arc tangent of the two input signals"
  y = atan(u1, u2)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/Atan2.svg"}
  }
}
end
````

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`Atan2`](Math.Atan2.md)

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

  * [`Constant`](Math.Atan2.md)

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