def scurve(start,end,n,s):
	"""Return an S-Curve with a constant velocity section from start to end with
	n points. The start and end S-curves each have s points"""
	ys,ye = start,end
	s1 = [ (ye-ys)*(x*x-s*s)/(2*s*float(n-1))+ys for x in range(0,s) ]
	cv = [ (ye-ys)*(x-s)/float(n-1)+ys for x in range(s,s+n) ]
	s2 = [ (ye-ys)*((s+n)*(s+n)+(4*s+2*n)*(x-s-n)-x*x)/(2*s*float(n-1))+ye for x in range(s+n+1,s+n+s+1) ]
	return s1+cv+s2