Function Repository Resource:

GeneralizedSmoothStep

A generalized sigmoidal interpolating polynomial

Contributed by: Jan Mangaldan
 ResourceFunction["GeneralizedSmoothStep"][n,x] is the generalized smoothstep function of order n at position x.

Details and Options

The generalized smoothstep function is defined as .
For nonnegative integer n and 0x1, ResourceFunction["GeneralizedSmoothStep"][n,x] is a polynomial of degree 2n+1.
For positions less than 0 or greater than 1, the result clamps to 0 and 1, respectively.
ResourceFunction["GeneralizedSmoothStep"] can be evaluated to arbitrary numerical precision.
ResourceFunction["GeneralizedSmoothStep"] automatically threads over lists.
The ResourceFunction["GeneralizedSmoothStep"]operation is common in computer graphics.

Examples

Basic Examples (2)

Interpolate at a position on a step:

 In[1]:=
 Out[1]=

Show the smooth steps for multiple orders:

 In[2]:=
 Out[2]=

Scope (4)

Evaluate at an exact position:

 In[3]:=
 Out[3]=

At a numeric position:

 In[4]:=
 Out[4]=

GeneralizedSmoothStep threads over lists:

 In[5]:=
 Out[5]=
 In[6]:=
 Out[6]=

Successive derivatives of GeneralizedSmoothStep can be expressed in terms of Piecewise:

 In[7]:=
 Out[7]=

Plot successive derivatives:

 In[8]:=
 Out[8]=

Applications (1)

Use GeneralizedSmoothStep to implement a "smooth" version of Hue (reference):

 In[9]:=
 In[10]:=
 Out[10]=
 In[11]:=
 Out[11]=

Properties and Relations (7)

GeneralizedSmoothStep is continuous from the left at x=0:

 In[12]:=
 Out[12]=
 In[13]:=
 Out[13]=
 In[14]:=
 Out[14]=

GeneralizedSmoothStep is continuous from the right at x=1:

 In[15]:=
 Out[15]=
 In[16]:=
 Out[16]=
 In[17]:=
 Out[17]=

GeneralizedSmoothStep[0,x] is equivalent to Clip:

 In[18]:=
 Out[18]=

GeneralizedSmoothStep[1,x] is equivalent to the resource function SmoothStep:

 In[19]:=
 Out[19]=

GeneralizedSmoothStep[2,x] is equivalent to the resource function SmootherStep:

 In[20]:=
 Out[20]=

GeneralizedSmoothStep can be expressed in terms of InterpolatingPolynomial and Clip:

 In[21]:=
 In[22]:=
 Out[22]=

GeneralizedSmoothStep can be expressed in terms of BetaRegularized and Clip:

 In[23]:=
 In[24]:=
 Out[24]=

Possible Issues (3)

GeneralizedSmoothStep is undefined for nonpositive integer orders:

 In[25]:=
 Out[25]=

GeneralizedSmoothStep is undefined for complex arguments:

 In[26]:=
 Out[26]=

GeneralizedSmoothStep[n,x] is (n+1)th-order discontinuous at x=0 and x=1:

 In[27]:=
 Out[27]=

Neat Examples (1)

Use GeneralizedSmoothStep to demonstrate "ease-in / ease-out":

 In[28]:=
 Out[28]=

Version History

• 2.0.0 – 20 March 2020
• 1.0.0 – 21 November 2019