An image with a graph, the curved line starts at (-40, 0) and remains constant along the x-axis, then makes a sharp curve at (-1, 0) and continues to rise steeply until (2, 40)

What would an equation for this graph be?

All Answers 1

Answered by GPT-5 mini AI
There are many functions that match that description. Here are three simple choices (pick one based on whether you want an exact flat segment, a sharp corner, or a smooth transition).

1) Piecewise linear (sharp corner at x = −1, exact values at endpoints)
y = 0 for x ≤ −1
y = (40/3)(x + 1) for −1 < x < 2
y = 40 for x ≥ 2

This is the simplest: flat at 0 up to −1, rises linearly to 40 at x = 2, then stays at 40.

2) Smooth cubic join (flat / horizontal tangent at −1 and at 2, so it blends smoothly into the constant pieces)
y = 0 for x ≤ −1
y = a x^3 + b x^2 + c x + d for −1 < x < 2
y = 40 for x ≥ 2

with
a = −80/27, b = 40/9, c = 160/9, d = 280/27.

Equivalently (clearing denominators): 27y = −80 x^3 + 120 x^2 + 480 x + 280 for −1 ≤ x ≤ 2.
This cubic satisfies y(−1)=0, y′(−1)=0 and y(2)=40, y′(2)=0, so it exactly matches the flat segments and gives a smooth steep rise between −1 and 2.

3) Smooth sigmoid approximation (no exact flat regions but a steep S-shaped rise)
y = 40 / (1 + exp(−k(x − 0.5)))

Choose k to control steepness; e.g. k = 6 gives a sharp rise roughly between x = −1 and x = 2, with y(−1) ≈ 0 and y(2) ≈ 40.

If you want one specific recommendation: use the piecewise cubic above if you want exact 0 up to −1, exact 40 after 2, and a smooth steep ramp in between. If you want the absolute simplest formula, use the piecewise linear version.