# A knockback system sets velocity = velocity-velocity*friction every second, what is the formula for the distance given that information?

I created a program that simulates a knockback system and since setting

$$velocity = velocity - (velocity*friction)$$,

the acceleration must be equals to,

$$a(t) = -velocity * friction$$

and the resulting velocity function must be,

$$v(t) = Initial Velocity - velocity * friction * t$$

which is equals to,

$$v(t) = \frac{InitialVelocity}{1 + Friction*t}$$

given the velocity formula the resulting distance formula would be,

$$d(t) =\int{v(t)} = \frac{InitialVelocity^2}{2(1+Friction*t)}$$

However, when I try to calculate the time given the distance, friction and Initial Velocity it gives me a wrong answer.