Piecewise Function Smooth Join Calculator
Enter the points and slopes of two outside lines. Construct a smooth cubic transition, compare its value and slope profiles with a straight join, and inspect exact limits and coefficients.
Build a smooth join between two lines
Match both endpoint slopes and check whether the transition reverses or leaves its value band.
Endpoint values and slopes
Enter where each outside line meets the join. Slopes use y units per x unit.
The smooth join stays in the endpoint band without reversing.
Transition checks
- Smooth join direction
- Increasing
- Smooth join range
- Stays within endpoint values
- Smooth slope range
- 0 to 25/9
- Straight join slope
- 2
Straight slope minus outside slope at the left and right joins2 / 1
Inspect the transition
50% across the join
- Probe x
- 2
- Smooth value
- 11/2
- Smooth slope
- 11/4
- Straight value
- 6
Export the join audit
View exact coefficients and slope limits
- t³ coefficient
- -12
- t² coefficient
- 20
- t coefficient
- 0
- Constant
- 2
- Minimum slope
- 0
- x = 0
- Maximum slope
- 25/9
- x = 20/9
t = (x − left x) / join width
View CSV text
How to use this calculator
- Enter x, value, and slope where the left and right lines meet the transition.
- Check whether the cubic moves in one direction and stays within the endpoint values.
- Switch between the value and slope plots. Move the probe to read the exact value and slope at that position.
- Open the coefficient and slope ledger or download the complete CSV.
The Formula
The mathematical logic powering this calculation is:
Let the given endpoint positions be x₀ < x₁ with values y₀ and y₁ and slopes m₀ and m₁. Write h = x₁ − x₀, t = (x − x₀)/h, and Δ = y₁ − y₀. A cubic Hermite join is p(t) = at³ + bt² + ct + y₀, where a = h(m₀ + m₁) − 2Δ, b = 3Δ − h(2m₀ + m₁), and c = hm₀. This gives the endpoint values and matches derivatives with respect to x. Outside the join, continue the line from each endpoint using its supplied slope.
The straight join is y₀ + Δt and has slope Δ/h. At each endpoint, compare that slope with the given outside slope. The cubic’s slope is (3at² + 2bt + c)/h. A quadratic’s minimum and maximum occur at its endpoints or at an interior vertex. If the exact slope takes both positive and negative values, the cubic changes direction on the join interval. An isolated zero slope is allowed on a monotone join.
To test the endpoint value band, factor p(t) − y₀ as t(at² + bt + c) and y₁ − p(t) as (1 − t)(at² + (a + b)t + Δ). Both outside factors are positive for 0 < t < 1. Check the signs of the quadratics at their endpoints and interior vertices, using the order of y₀ and y₁. This distinguishes a curve that reverses but stays inside the band from one that exceeds an endpoint value. A curve can touch the boundary and still stay within the band.
Enter decimals from −1,000,000 through 1,000,000 with up to six fractional places. Coefficients, slope limits and all classification tests use exact fractions. The chart uses drawing coordinates derived from the same curves. The cubic matches values and first derivatives at the joins. Curvature can change across either boundary.Worked Example
If you input:
- Left x, value, slope: 0, 2, 0
- Right x, value, slope: 4, 10, 1
Result:
The join is p(t) = −12t³ + 20t² + 2, with t = x/4. It increases and stays between 2 and 10. At x = 2 its value is 11/2 and its slope is 11/4. The straight segment has slope 2.
Frequently Asked Questions
Why can a smooth transition overshoot?
Matching both endpoint tangents can send the cubic in different directions across the interval. The size and sign of each slope, relative to the slope of the straight join, affect the curve.
Can the curve reverse direction without overshooting?
Yes. The curve can rise, fall, and rise again while staying inside the value band defined by its two endpoints.
What does matching the slopes make continuous?
Both the value and first derivative agree with the outside lines at each join. This is C¹ continuity. Matching curvature would impose a second-derivative condition.
Can the join end at the same height it starts?
Yes. With equal values the endpoint band has zero thickness. Any nonconstant join leaves that band. Both slopes must be zero to keep the entire join constant.
Similar Calculators
Piecewise Function Graph Calculator
Graph a piecewise function with open and closed endpoints. Evaluate f(x), compare one-sided limits, and identify gaps, jumps and removable discontinuities.
Polynomial Tangent Line and Contact Calculator
Find an exact polynomial tangent line and every place it meets the curve. Graph the signed tangent gap and distinguish crossing from touching.
Mean Value Theorem & Tangent Line Calculator
Find where a tangent matches the secant slope, check Mean Value Theorem and Rolle’s conditions, or calculate a tangent line at a chosen point.
