I want a formula that changes acceleration. At a velocity of X I want the velocity to decrease to 0 in exactly X seconds, with a distance of X. So the acceleration will increase over time to make the velocity 0 within X seconds and at a distance of X.
Are you sure you want velocity, time and distance of the deceleration part to be the same? For low values it would look and the unit would barely move and for high values the unit will take forever to stop, doing so very slowly.
If you meant that they are separate variables...
You start from a constant speed X and time 0 (if not 0, then apply appropriate offset).
The time over which it should reach 0 speed is Y.
The distance over which it should reach 0 speed is Z.
The double integral of acceleration between time 0 and time Y is Z.
The speed, X, is the constant of integration of the integral of acceleration.
The integral of acceleration between time 0 and time Y factoring in X is 0.
As you might be able to guess, this is not an easy problem to solve since you have to find an acceleration formula such that its integral between 0 and time Y satisfies an equation while its double integral between 0 and time Y satisfies another.
integrate2(Acceleration, Y, 0) + Y * X = Z
integrate1(Acceleration, Y, 0) + X = 0
integrate2(Acceleration, Y, 0) = Z - Y * X
integrate1(Acceleration, Y, 0) = -X
Assuming linear acceleration...
integrate1x(k, Y, 0) -> kx using x[Y, 0] = Yk - 0k = Yk
integrate2x(k, Y, 0) -> kx^2/2 using x[Y, 0] = Y^2k/2 - 0k = Y^2k/2
Y^2k/2 = Z - Y * X
Yk = -X
I do not think a value of k exists so linear acceleration is out.
Assuming quadratic acceleration...
integrate1x(kx + l, Y, 0) -> kx^2/2 + lx using x[Y, 0] = kY^2/2 + lY
integrate2x(kx + l, Y, 0) -> kx^3/6 + lx^2/2 using x[Y, 0] = kY^3/6 + lY^2/2
kY^3/6 + lY^2/2 = Z - Y * X
kY^2/2 + lY = -X
This might be solvable? I am not sure.