# Solving speed profile for total time

I'm trying to create a stepper motor speed profile where the total time, number of steps and acceleration are known and max speed is be calculated. I believe I have got the formula correctly down to this.

$$total steps = (total time * speed) - (\frac{3 * speed^2}{2 * acceleration})$$

and now I am stuck, trying to rearrange so I have speed as a single term and can solve for it. I'm very rusty at rearranging equations so I was quite pleased I got this far, but I just can't seem to get speed on it's own. Can anyone help?

Write \begin{align} s&=total steps\\ t&=total time\\ a&=acceleration\\ x&=speed, \end{align} so that the equation becomes $$s=tx-{3x^2\over2a}$$ Multiply through by $$2a$$ and bring all terms over to the left-hand side:$$3x^2-2atx+2as=0$$ This is a quadratic equation with two solutions: $$x= {2at\pm\sqrt{4a^2t^2-24as}\over6}={2at\pm 2\sqrt{a^2t^2-6as}\over6}= {at\pm \sqrt{a^2t^2-6as}\over3}$$
For the square root to make sense, we need $$a^2t^2\geq6as,$$ that is $$at^2\geq6s.$$ Note that the square root will be less than $$at$$ so that this formula gives two positive numbers as possible values of the the speed. If your original formula is correct, you'll have to use some other information to determine which value represents the actual speed.