Square Root
systemic:core-sqrtMathInputs
| Name | Type | Description |
|---|---|---|
| Data | Number series | The series of numbers to take the square root of. |
Outputs
| Name | Type | Description |
|---|---|---|
| Sqrt | Number series | The square root of each input value. |
Cost
0.198 + 0.00574·n credits for n bars, rounded up. The marks are each plan's limit of bars.
Computes the square root of each value. It reduces the scale of extreme values and keeps their order.
| Input | Output |
|---|---|
| 0 | 0 |
| 4 | 2 |
| 100 | 10 |
| 10,000 | 100 |
Input Constraint
⚠️ Important: Input values should be non-negative (≥ 0). A negative number has no real square root, so a negative input gives an empty output on that bar.
The Compression Effect
Square root compresses large values more than small ones:
| Original | √ Result | Compression |
|---|---|---|
| 1 | 1 | 1:1 |
| 100 | 10 | 10:1 |
| 10,000 | 100 | 100:1 |
| 1,000,000 | 1,000 | 1000:1 |
This makes data with extreme outliers (like volume or market cap) easier to compare and analyze.
Practical Example: Volume Normalization
Trading volume differs by orders of magnitude across assets. The square root brings the values closer together:
| Stock Type | Raw Volume | √ Volume |
|---|---|---|
| Small-cap | 100,000 | 316 |
| Mid-cap | 1,000,000 | 1,000 |
| Large-cap | 100,000,000 | 10,000 |
A 1,000× difference in raw volume becomes a difference of about 32× after the square root.
Square Root vs. Power with Exponent 0.5
Both give the same result, including an empty value for a negative input. Square Root:
- Needs only one input
- Makes the intent clearer
Use Power with exponent 0.5 if you need more flexibility (for example, other exponents).
Related Modules
- Power — General exponentiation (use exponent 2 to reverse a square root)
- Absolute — Makes the input non-negative before the square root
- Divide — Alternative normalization (ratio-based)
| Transform | Compression | Best For |
|---|---|---|
| √x | Moderate | Volume, counts, moderate outliers |
| log(x) | Strong | Price ratios, returns, extreme outliers |
Use the square root when you want to reduce scale without flattening the data completely.
Missing Data
When an input value is missing (empty), the output on that bar is empty too. This happens, for example, when a stock series has no bar on a weekend or holiday. Gaps are never filled: every output value is the square root of a real input value.
Handling Negative Inputs
The square root of a negative value does not exist. This is different from missing data, but both give an empty output:
- Missing input → empty: there was no value to compute from
- Negative input → empty: there was a value, but its square root is undefined
If your data may contain negative values, connect it through the Absolute module first to make it non-negative.
Quick Reference
| Input | Output |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 4 | 2 |
| 9 | 3 |
| 2.25 | 1.5 |
| 1,000,000 | 1,000 |