Pow Pow Icon

Mathematical.Pow

Pow

A component that raises one input signal to the power of another.

Description

The Pow block raises input u1 to the power of u2. The output y is defined as: y = sign(u1) * (abs(u1) ^ u2). This formulation preserves the sign when raising negative numbers to a power.

Variables

  • u1(t): First input signal (base)
  • u2(t): Second input signal (exponent)
  • y(t): Output signal (u1 raised to the power of u2)

Examples

  • u1 = 2, u2 = 3 → y = 8 (2^3 = 8)
  • u1 = 4, u2 = 0.5 → y = 2 (square root of 4)
  • u1 = 5, u2 = -1 → y = 0.2 (1 / 5)
  • u1 = -2, u2 = 3 → y = -8 (-2^3 = -8)

This component extends from BlockComponents.SI2SO

Usage

PrimitiveComponents.Mathematical.Pow()

Connectors

  • u1 - This connector represents a real signal as an input to a component (RealInput)
  • u2 - This connector represents a real signal as an input to a component (RealInput)
  • y - This connector represents a real signal as an output from a component (RealOutput)

Behavior

\[ \begin{align} y\left( t \right) &= \left( \left|\mathtt{u1}\left( t \right)\right| \right)^{\mathtt{u2}\left( t \right)} sign\left( \mathtt{u1}\left( t \right) \right) \end{align} \]

Source

"""
    Pow

A component that raises one input signal to the power of another.

# Description
The Pow block raises input `u1` to the power of `u2`.
The output `y` is defined as: y = sign(u1) * (abs(u1) ^ u2).
This formulation preserves the sign when raising negative numbers to a power.

# Variables
- `u1(t)`: First input signal (base)
- `u2(t)`: Second input signal (exponent)
- `y(t)`: Output signal (u1 raised to the power of u2)

# Examples
- u1 = 2,  u2 = 3   → y = 8       (2^3 = 8)
- u1 = 4,  u2 = 0.5 → y = 2       (square root of 4)
- u1 = 5,  u2 = -1  → y = 0.2     (1 / 5)
- u1 = -2, u2 = 3   → y = -8      (-2^3 = -8)
"""
component Pow
  extends BlockComponents.SI2SO()
relations
  y = sign(u1) * (abs(u1) ^ u2)
metadata {
  "Dyad": {
    "experiments": {},
    "tests": {},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 1100,
        "rot": 0,
        "layer": "icon",
        "attrs": {}
      }
    ],
    "icons": {"default": "dyad://PrimitiveComponents/Pow.svg"},
    "path": {},
    "doc": {"behavior": true}
  }
}
end
Flattened Source
"""
    Pow

A component that raises one input signal to the power of another.

# Description
The Pow block raises input `u1` to the power of `u2`.
The output `y` is defined as: y = sign(u1) * (abs(u1) ^ u2).
This formulation preserves the sign when raising negative numbers to a power.

# Variables
- `u1(t)`: First input signal (base)
- `u2(t)`: Second input signal (exponent)
- `y(t)`: Output signal (u1 raised to the power of u2)

# Examples
- u1 = 2,  u2 = 3   → y = 8       (2^3 = 8)
- u1 = 4,  u2 = 0.5 → y = 2       (square root of 4)
- u1 = 5,  u2 = -1  → y = 0.2     (1 / 5)
- u1 = -2, u2 = 3   → y = -8      (-2^3 = -8)
"""
component Pow
  "First real-valued input signal"
  u1 = RealInput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": -50, "y1": 150, "x2": 50, "y2": 250, "rot": 0},
        "diagram": {"iconName": "default", "x1": -100, "y1": 150, "x2": 0, "y2": 250, "rot": 0}
      }
    }
  }
  "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
  y = sign(u1) * (abs(u1) ^ u2)
metadata {
  "Dyad": {
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 1100,
        "rot": 0,
        "layer": "icon",
        "attrs": {}
      }
    ],
    "experiments": {},
    "tests": {},
    "icons": {"default": "dyad://PrimitiveComponents/Pow.svg"},
    "path": {},
    "doc": {"behavior": true}
  }
}
end


Test Cases

No test cases defined.

  • Examples
  • Experiments
  • Analyses