---
url: /dyad/dev/stdlib/BlockComponents/components/Math.Log.md
description: >-
  Dyad Math.Log docs.  Output the logarithm (default base e) of the input (input
  > 0 required).
---

# `Math.Log` {#Math.Log}

Output the logarithm (default base e) of the input (input > 0 required).

Computes the output `y` as the logarithm to the parameter `base` of the input `u`:

$$y = \frac{\ln(u)}{\ln(\text{base})}$$

The default base is Euler's number e ≈ 2.71828, giving the natural logarithm. The input must be positive.

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

## Usage {#Usage}

`BlockComponents.Math.Log(base=exp(1.0))`

## Parameters: {#Parameters:}

|   Name |       Description | Units | Default value |
| ------:| -----------------:| -----:| -------------:|
| `base` | Base of logarithm |     – |      exp(1.0) |

## 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) &= \frac{\log\left( u\left( t \right) \right)}{\log\left( \mathtt{base} \right)}
\end{align}
$$

## Source {#Source}

````dyad
"""
Output the logarithm (default base e) of the input (input > 0 required).

Computes the output `y` as the logarithm to the parameter `base` of the
input `u`:

```math
y = \\frac{\\ln(u)}{\\ln(\\text{base})}
```

The default base is Euler's number e ≈ 2.71828, giving the natural logarithm.
The input must be positive.
"""
component Log
  extends BlockComponents.Interfaces.SISO
  "Base of logarithm"
  parameter base::Real = exp(1.0)
relations
  "Computes the logarithm of the input signal to the given base"
  y = log(u) / log(base)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/Log.svg"}
  }
}
end
````

````dyad
"""
Output the logarithm (default base e) of the input (input > 0 required).

Computes the output `y` as the logarithm to the parameter `base` of the
input `u`:

```math
y = \\frac{\\ln(u)}{\\ln(\\text{base})}
```

The default base is Euler's number e ≈ 2.71828, giving the natural logarithm.
The input must be positive.
"""
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}
      }
    }
  }
  "Base of logarithm"
  parameter base::Real = exp(1.0)
relations
  "Computes the logarithm of the input signal to the given base"
  y = log(u) / log(base)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/Log.svg"}
  }
}
end
````

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

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

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

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

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