Log Log Icon

Mathematical.Log

Log

A component that computes the natural logarithm (base e) of the input signal.

Description

The Log block computes the natural logarithm of input u using the built-in log() function. The output is defined as: y = log(u), where the logarithm is with respect to base e (Euler's number ≈ 2.71828). Note: The input u must be positive (u > 0) for real-valued output.

Variables

  • u(t): Input signal (must be positive)
  • y(t): Output signal (natural logarithm of u)

Examples

  • u = 1 → y = 0.0 (log(1) = 0)
  • u = e → y = 1.0 (log(e) = 1)
  • u = 10 → y ≈ 2.3026 (log(10))
  • u = 0.5 → y ≈ -0.6931 (log(0.5))

This component extends from BlockComponents.SISO

Usage

PrimitiveComponents.Mathematical.Log()

Connectors

  • u - 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) &= \log\left( u\left( t \right) \right) \end{align} \]

Source

"""
    Log

A component that computes the natural logarithm (base e) of the input signal.

# Description
The Log block computes the natural logarithm of input `u` using the built-in `log()` function.
The output is defined as: y = log(u), where the logarithm is with respect to base e (Euler's number ≈ 2.71828).
Note: The input `u` must be positive (`u > 0`) for real-valued output.

# Variables
- `u(t)`: Input signal (must be positive)
- `y(t)`: Output signal (natural logarithm of u)

# Examples
- u = 1     → y = 0.0        (log(1) = 0)
- u = e     → y = 1.0        (log(e) = 1)
- u = 10    → y ≈ 2.3026     (log(10))
- u = 0.5   → y ≈ -0.6931    (log(0.5))
"""
component Log
  extends BlockComponents.SISO
relations
  y = log(u)
metadata {
  "Dyad": {
    "experiments": {},
    "tests": {},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 1100,
        "rot": 0,
        "layer": "icon",
        "attrs": {}
      }
    ],
    "icons": {"default": "dyad://PrimitiveComponents/Log.svg"},
    "path": {},
    "doc": {"behavior": true}
  }
}
end
Flattened Source
"""
    Log

A component that computes the natural logarithm (base e) of the input signal.

# Description
The Log block computes the natural logarithm of input `u` using the built-in `log()` function.
The output is defined as: y = log(u), where the logarithm is with respect to base e (Euler's number ≈ 2.71828).
Note: The input `u` must be positive (`u > 0`) for real-valued output.

# Variables
- `u(t)`: Input signal (must be positive)
- `y(t)`: Output signal (natural logarithm of u)

# Examples
- u = 1     → y = 0.0        (log(1) = 0)
- u = e     → y = 1.0        (log(e) = 1)
- u = 10    → y ≈ 2.3026     (log(10))
- u = 0.5   → y ≈ -0.6931    (log(0.5))
"""
component Log
  "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
  y = log(u)
metadata {
  "Dyad": {
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 1100,
        "rot": 0,
        "layer": "icon",
        "attrs": {}
      }
    ],
    "experiments": {},
    "tests": {},
    "icons": {"default": "dyad://PrimitiveComponents/Log.svg"},
    "path": {},
    "doc": {"behavior": true}
  }
}
end


Test Cases

No test cases defined.

  • Examples
  • Experiments
  • Analyses