Curve Divergence Calculator: How to Measure Line Separation
- Avg divergence rate
- units per x
- Result
- Curve 1 y-value
- 10 units
- You entered
- Curve 2 y-value
- 7 units
- You entered
This calculator works out how far apart two curves are at a given point along the x-axis. You enter the y-values of the two curves at that x, and the calculator returns the vertical divergence (the absolute difference) and, if you provide the x-values of two points, the average rate of divergence between them. The result is a simple number in the same units as your y-values.
Formula
The core formula is simple: vertical divergence = |y₁ − y₂|. If you also want the average rate of divergence between two x-values, use average divergence rate = (y₁ − y₂) / (x₂ − x₁). Here:
- y₁ – value of the first curve at the chosen x (in your units, e.g., meters, dollars, degrees).
- y₂ – value of the second curve at the same x (same units as y₁).
- x₁, x₂ – two x-coordinates (any unit, but must be consistent).
- |…| – absolute value, so divergence is always non-negative.
For two straight lines, this gives the exact vertical gap at any x. For curved lines, it gives the vertical gap at the specific x you input, not the perpendicular distance.
Worked Example
Using the default values: y₁ = 10, y₂ = 7, x₁ = 0, x₂ = 5.
- Vertical divergence = |10 − 7| = 3 units.
- Average divergence rate = (10 − 7) / (5 − 0) = 3 / 5 = 0.60 units per x.
The calculator shows 3.00 for divergence and 0.60 for the rate, matching the formula exactly.
When to Use This Calculator
You might use this when comparing two datasets, two forecast models, or two experimental results plotted on the same axes. For example, if you have predicted sales vs. actual sales over time, the divergence at each month tells you the error. If you have two temperature sensors in a room, the divergence shows how much they disagree at a given moment. The average rate of divergence is useful when you want to know whether the gap is growing, shrinking, or staying constant as x increases.
How to Read the Result
The divergence number is in the same units as your y-values. A divergence of 3 means the curves are 3 units apart vertically at that x. The rate of divergence tells you how quickly that gap changes per unit of x. A positive rate means the first curve is above the second and the gap is increasing; a negative rate means the gap is decreasing. If you only need the gap, ignore the rate. If you need to know whether the curves cross, look for where the divergence becomes zero.
Common Mistakes and Misconceptions
- Using perpendicular distance instead of vertical. This calculator gives vertical separation. If your curves are steep, the true perpendicular distance is smaller. For most comparisons, vertical separation is what you want.
- Mixing units. If y is in meters and x is in seconds, the rate is meters per second. If you mix centimeters and meters, the result is meaningless. Keep units consistent.
- Forgetting absolute value. Divergence is a magnitude, so it should never be negative. The calculator takes the absolute value automatically.
- Assuming the rate is constant. The average rate between two points is not the instantaneous rate unless the curves are straight lines. For curved lines, the actual divergence may change non-linearly between x₁ and x₂.
Limits of the Formula
This is a pointwise comparison. It does not tell you the total area between the curves, nor the maximum divergence over an interval. It only gives the gap at a single x (and the average slope between two x’s). If you need the area between curves, you would integrate |f(x) − g(x)| over the interval. If you need the maximum gap, you would find where the derivative of the difference equals zero. Also, if your curves are not functions (e.g., a circle), a vertical line may intersect them more than once, and you need to specify which y-value to use.
Frequently Asked Questions
What if my curves are defined by equations, not just y-values?
Enter the y-values you get by plugging your chosen x into each equation. For example, if f(x) = x² and g(x) = x + 2, at x = 3, y₁ = 9 and y₂ = 5, so divergence = 4.
Can I use this for more than two curves?
You can compare any pair. To compare three curves, run the calculator for each pair (A vs B, B vs C, A vs C). There is no built-in multi-curve mode, but the process is the same.
Is vertical divergence the same as Euclidean distance?
No. Euclidean distance is the straight-line distance between two points, which accounts for both x and y differences. Vertical divergence ignores the x difference. If the curves are at the same x (which is typical), the Euclidean distance equals the vertical divergence only if the x-coordinates are identical.
What does a negative rate of divergence mean?
It means the gap between the curves is decreasing as x increases. The first curve is getting closer to the second. If the rate is zero, the gap stays constant.
Can I use this to compare two time series?
Yes, if you align the time points. Plot both series on the same time axis, then pick a specific time (x) and read the y-values. The divergence is the difference at that time. The rate of divergence over a time interval tells you how quickly the series are converging or diverging.
Why is the calculator giving a different answer than my spreadsheet?
Check that you are using the same y-values and the same x-values. Also check that your spreadsheet formula uses absolute value. A common error is subtracting in the wrong order, which flips the sign but not the magnitude. The calculator uses absolute value, so the magnitude should match.
Related
Formula used
in y1 | Curve 1 y-value | units | 10 | 0 in y2 | Curve 2 y-value | units | 7 | 0 in x1 | x at first point | - | 0 | 0 in x2 | x at second point | - | 5 | 0 out diff | Vertical divergence | units | abs(y1 - y2) | 2 out slope | Avg divergence rate | units per x | (y1 - y2) / (x2 - x1) | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.