Soft Launch 🚀 Get notified when we officially launch.

Docs
Convolve Function

Convolve Function

Performs a discrete convolution of an inflow series with a time-based distribution curve.

How the Convolve Function Works

At its core, convolve() performs a discrete convolution. It takes an incoming stream of data, applies a time-based profile to it, and calculates the aggregate state for every period.

It automatically remembers how much volume enters in each period, calculates its age relative to today, applies your curve, and sums up the active survivors or remaining value from every past group to give you the total output.

The Underlying Math

While convolution is a purely mathematical concept, the easiest way to visualize it is through a classic SaaS retention cohort matrix:

Period 0
Period 1
Period 2
Period 3
RetentionCurve by age
100%
80%
60%
50%
Additions
100
200
300
400
Cohort 1Joined P0
Cohort 2Joined P1
Cohort 3Joined P2
Cohort 4Joined P3
Total Active

Common Use Cases

Because convolve() is mathematically agnostic, you can use it for far more than just user cohorts. By changing what your inflow and curve represent, the function adapts to a variety of modeling scenarios:

  • SaaS Retention: Inflow (New Signups) × Curve (Retention Rate) = Total Active Users
  • Asset Depreciation: Inflow (Capital Expenditures) × Curve (Depreciation Schedule) = Net Book Value (Note: if you use useful life to model depreciation, we have another function depreciate that handles depreciation specifically.)
  • Expansion Revenue: Inflow (Base Tier Users) × Curve (Upgrade Probability) = Total Upgraded Accounts
  • Inventory Management: Inflow (Units Produced) × Curve (Historical Sell-Through) = Remaining Inventory
  • RSU Vesting Schedules: Inflow (New RSU Grants) × Curve (Distribution) = Agrregate Sum

Arguments

The function requires two primary series to run, and accepts an optional filter to pause incoming data.

Inflow (Required): The sequence of new inputs entering the system for each period. For example, if 100 units arrive in Period 0 and 200 arrive in Period 1, this array tracks those incoming batches.

Curve (Required): The distribution or decay curve applied to each inflow over time.

Filter (Optional): A boolean mask or condition to pause new inflows from entering the calculation. If you set this to 0 (false) for a specific period, no new inflows will be added, but your older, existing cohorts will continue to age and distribute normally.