Systemicalpha

ArcCosine

systemic:core-arccosMathfunction1 cr

Inputs

NameTypeDescription
DatafloatarrayThe input data series for the arccosine calculation.

Outputs

NameTypeDescription
ArcCosfloatarrayThe arccosine of each input value, expressed in **radians**.

The Arccosine module computes the inverse cosine of each value in a data series, returning the angle in radians whose cosine equals that value. This mathematical transformation has surprisingly powerful applications in finance—from analyzing correlation dynamics to building angular momentum indicators.

y=arccos⁡(x)wherecos⁡(y)=xy = \arccos(x) \quad \text{where} \quad \cos(y) = x

Mathematical Foundation

Domain and Range

flowchart LR
    subgraph Domain["Input Domain"]
        D["-1 ≤ x ≤ 1"]
    end
    
    subgraph Transform["ARCCOS"]
        F["arccos(x)"]
    end
    
    subgraph Range["Output Range"]
        R["0 to π radians<br/>(0° to 180°)"]
    end
    
    D --> F --> R
PropertyValue
Domainx∈[−1,1]x \in [-1, 1]
Rangey∈[0,π]y \in [0, \pi] radians (0° to 180°)

Important: Input values must be between -1 and 1 (inclusive). Values outside this range have no defined arccosine, so those positions output null — the math is never faked with a substitute value.

Key Values Reference

Input xxOutput (radians)Output (degrees)Interpretation
100°Perfect positive correlation
0.51.04760°Moderate positive
01.57190°Orthogonal / uncorrelated
-0.52.094120°Moderate negative
-13.142180°Perfect negative correlation

Financial Application: Correlation Angle

One of the most elegant uses of arccosine in finance is converting correlation coefficients to angular distances. This transformation reveals the true geometric relationship between assets.

Why Convert Correlation to Angle?

Correlation coefficients are bounded and non-linear:

  • The difference between 0.9 and 0.95 correlation is much more significant than between 0.1 and 0.15
  • Arccos "stretches" the extremes, making small changes at high correlation visible
flowchart TD
    subgraph Input["Correlation Coefficient"]
        CORR["Asset A vs Asset B<br/>ρ = 0.85"]
    end
    
    subgraph Transform["ARCCOS Module"]
        ARC["arccos(0.85)"]
    end
    
    subgraph Output["Angular Distance"]
        ANGLE["θ = 31.8°<br/>Assets are 31.8° apart"]
    end
    
    CORR --> ARC --> ANGLE

Portfolio Diversification Insight

CorrelationAngleDiversification Benefit
1.00°None — assets move identically
0.745°Moderate — some diversification
0.090°Maximum — truly independent
-1.0180°Perfect hedge

This angular representation is used in advanced portfolio optimization techniques like the angular distance matrix for hierarchical risk parity.


Creative Use Case: Correlation Breakdown Detector

Monitor when correlation between assets is changing rapidly by tracking the rate of change of the angular distance:

flowchart LR
    subgraph System["Correlation Regime Detector"]
        CORR["Rolling Correlation<br/>(20-period)"] --> ARCCOS["ARCCOS"]
        ARCCOS --> ROC["Rate of Change"]
        ROC --> Signal{"ROC > threshold?"}
        Signal -->|Yes| Alert["⚠️ Regime Shift"]
        Signal -->|No| Normal["Normal"]
    end

Use case: During market stress, correlations spike toward 1.0 (angle → 0°). By monitoring the angular rate of change, you can detect regime shifts before they fully manifest in price action.


The Transformation Curve

Understanding how arccos reshapes data:

RegionBehavior
Near x=1x = 1Steep — small changes in correlation → large angle changes
Near x=0x = 0Moderate — roughly linear response
Near x=−1x = -1Steep — symmetric to x=1x = 1

This property makes arccos ideal for amplifying signals near the correlation extremes where small differences matter most.


Missing Data

When an input position is missing (null) — for example, a stock series has no bar on a weekend or holiday — the output at that same position is null. Values are never invented to fill a gap: every non-null output is the true arccosine of a real datapoint.

In live mode, the module returns exactly one datapoint — the most recent position — and it may be null when no bar exists at that moment (e.g., a weekend tick on a market-hours series). That gap is correct, not an error.


Handling Invalid Inputs

A value outside [−1,1][-1, 1] is a real datapoint whose arccosine simply does not exist — distinct from missing data, where no datapoint exists at all. Both surface as null in the output, but they mean different things:

  • Missing input → null: there was no bar to compute from
  • Out-of-range input → null: there was a bar, but the math is undefined for it

If out-of-range values are expected in your data, pre-filter with the CLAMP module to keep inputs inside [−1,1][-1, 1].


Converting Radians to Degrees

The output is in radians. To convert to degrees:

degrees=radians×180π≈radians×57.2958\text{degrees} = \text{radians} \times \frac{180}{\pi} \approx \text{radians} \times 57.2958

Use a Multiply module with a constant of 57.2958 to convert.


Further Reading

Rendering diagrams...
© 2026 WanoLabs. All rights reservedAlpha build v0.1.5