Math

SquareRoot Block

Calculates the n-th root of the input signal

Open SquareRoot in BlockWerk →

# SquareRoot Block

Description

The SquareRoot block calculates the n-th root of the input signal. While named SquareRoot for common usage (where n=2), it is a versatile root-calculation block that supports cube roots (n=3) and any other numeric root order.

Mathematical Model

The block implements the following calculation:

y(t) = in(t) ^ (1/n)

Where:

Handling of Negative Inputs

Calculating the root of a negative number can be problematic for even root orders (e.g., √-1). The block provides several configurable safety modes:

1. Return Zero (Default): Outputs 0.0 when a negative input is encountered. This is the safest option for simulation stability and includes a one-time visual warning. 2. Use Absolute Value: Calculates the root of the absolute value of the input. Useful when the sign of the signal is irrelevant for the root calculation. 3. Return NaN: Returns "Not a Number". Note that this value will propagate through your diagram and may cause other blocks to output NaN.

Parameters

Root Order (n)

The order of the root to calculate.

Negative Input

Specifies the behavior when the input signal falls below zero.

Report Warning

When enabled (true), displays a visual popup warning in the UI the first time a negative input is detected.

Examples

Distance Calculation

Calculate the distance from coordinates (x, y):

Sum (x^2 + y^2) → SquareRoot (n=2) → Distance

Flow Measurement

Calculate fluid flow rate from differential pressure (where flow ∝ √ΔP):

PressureDifference → SquareRoot (n=2) → FlowRate

Remarks

See Also