1. Kinematic basicsThe linear acceleration (ramping) formulas are:
S - acceleration distance, in stepper motor case - number of steps,
v0 - initial velocity, base speed (steps per second),
v - target velocity, slew speed (steps per second),
a - acceleration (steps per second per second),
t - acceleration time, ramping period (seconds).
By rearranging 
and putting it in  we have
that can be represented as a recursive form of speed calculation for one step:
i - step number (1 < i < S).
2. Control basicsTo produce the speed profile for stepper motor we need to provide the real time delays between step pulses:
pi - delay period for the i-th step (timer ticks),
F - timer frequency (count of timer ticks per second),
so according to  the exact delay value will be:
3. ApproximationUsing Taylor series
when -1 < n < 1 we can approximate  to
Let's check the -1 < n < 1 condition. Our n was
or, by velocity,
The maximum n value will be at minimum speed, on the first calculated step, where i = 2
Because the minimal v0 is 0, from  we have
So n will be always less than or equal to 1. Because our calculations are forward-only we have no limitation in case of deceleration (negative acceleration) too.
4. ImplementationThe given parameters are:
v0 - base speed,
v - slew speed,
a - acceleration,
F - timer frequency
and the calculated parameters are:
S - acceleration/deceleration distance
p1 - delay period for the initial step
pS - delay period for the slew speed steps
R - constant multiplier
The variable delay period p (initially p = p1) that will be recalculated for each next step is:
m - variable multiplier that depends on the movement phase:
m = -R during acceleration phase,
m = 0 between acceleration and deceleration phases,
m = R during deceleration phase.
For accuracy purpose let's set
p = pS if p < pS or between acceleration and deceleration phases,
p = p1 if p > p1 .
5. Optional enhancementUsing the higher order approximation of Taylor series
we can get more accurate results replacing  with
q = m . p . p .
By  we have excellent precision but with two extra multiplications and one extra addition vs 's good precision way. Finally let's construct a very good compromise with just one extra multiplication and one extra addition:
However I think that the good way () is not merely good but even good enough for most of stepper motor applications.
The enhancement is important for servo drivers with the step/direction control that ramping up from and down to zero speed.
6. Programming noteThis algorithm was designed for floating point mathematics and in this form it works faster than in the integer form that requires division.
|* This algorithm was developed by the author in
1994 for L.I.D. Ltd as a part of POEM Stepper Organizer
software to control up to 4 axes through IBM PC's
parallel port (LPT) and was ported to microcontroller
platform in 2004.
The main field of usage since 1994 - laser diamond cutting.
** Special thanks to David Austin <email@example.com> who helped me with the enhancement part.