---
url: /dyad/stable/stdlib/BlockComponents/components/Math.RectangularToPolar.md
description: >-
  Dyad Math.RectangularToPolar docs.  Converts rectangular coordinates to polar
  coordinates.
---

# `Math.RectangularToPolar` {#Math.RectangularToPolar}

Converts rectangular coordinates to polar coordinates.

Computes the polar representation from rectangular (Cartesian) inputs:

$$y\_{\text{abs}} = \sqrt{u\_{\text{re}}^2 + u\_{\text{im}}^2}$$

$$y\_{\text{arg}} = \operatorname{atan2}(u\_{\text{im}}, u\_{\text{re}})$$

## Usage {#Usage}

`BlockComponents.Math.RectangularToPolar()`

## Connectors {#Connectors}

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

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

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

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

## Behavior {#Behavior}

$$ \begin{align}
\mathtt{y_abs}\left( t \right) &= \sqrt{\left( \mathtt{u_im}\left( t \right) \right)^{2} + \left( \mathtt{u_re}\left( t \right) \right)^{2}} \\
\mathtt{y_arg}\left( t \right) &= \arctan\left( \mathtt{u_im}\left( t \right), \mathtt{u_re}\left( t \right) \right)
\end{align}
$$

## Source {#Source}

````dyad
"""
Converts rectangular coordinates to polar coordinates.

Computes the polar representation from rectangular (Cartesian) inputs:

```math
y_{\\text{abs}} = \\sqrt{u_{\\text{re}}^2 + u_{\\text{im}}^2}
```
```math
y_{\\text{arg}} = \\operatorname{atan2}(u_{\\text{im}}, u_{\\text{re}})
```
"""
component RectangularToPolar
  "Real part of the rectangular representation"
  u_re = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 160, "x2": 0, "y2": 260, "rot": 0}
      },
      "tags": []
    }
  }
  "Imaginary part of the rectangular representation"
  u_im = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 690, "x2": 0, "y2": 790, "rot": 0}
      },
      "tags": []
    }
  }
  "Absolute value (length) of the polar representation"
  y_abs = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 160, "x2": 1100, "y2": 260, "rot": 0}
      },
      "tags": []
    }
  }
  "Angle of the polar representation"
  y_arg = RealOutput(units = "rad") {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 720, "x2": 1100, "y2": 820, "rot": 0}
      },
      "tags": []
    }
  }
relations
  "Computes the absolute value from rectangular components"
  y_abs = sqrt(u_re * u_re + u_im * u_im)
  "Computes the angle from rectangular components"
  y_arg = atan(u_im, u_re)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/RectangularToPolar.svg"}
  }
}
end
````

````dyad
"""
Converts rectangular coordinates to polar coordinates.

Computes the polar representation from rectangular (Cartesian) inputs:

```math
y_{\\text{abs}} = \\sqrt{u_{\\text{re}}^2 + u_{\\text{im}}^2}
```
```math
y_{\\text{arg}} = \\operatorname{atan2}(u_{\\text{im}}, u_{\\text{re}})
```
"""
component RectangularToPolar
  "Real part of the rectangular representation"
  u_re = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 160, "x2": 0, "y2": 260, "rot": 0}
      },
      "tags": []
    }
  }
  "Imaginary part of the rectangular representation"
  u_im = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -100, "y1": 690, "x2": 0, "y2": 790, "rot": 0}
      },
      "tags": []
    }
  }
  "Absolute value (length) of the polar representation"
  y_abs = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 160, "x2": 1100, "y2": 260, "rot": 0}
      },
      "tags": []
    }
  }
  "Angle of the polar representation"
  y_arg = RealOutput(units = "rad") {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 720, "x2": 1100, "y2": 820, "rot": 0}
      },
      "tags": []
    }
  }
relations
  "Computes the absolute value from rectangular components"
  y_abs = sqrt(u_re * u_re + u_im * u_im)
  "Computes the angle from rectangular components"
  y_arg = atan(u_im, u_re)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/RectangularToPolar.svg"}
  }
}
end
````

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

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

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

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

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