def cos_edge(f=Ellipsis, width=np.pi, offset=<NUM_LIT:0>, scale=<NUM_LIT:1>):
f = to_potential(f)<EOL>freq = np.pi/<NUM_LIT:2><EOL>(xmn,xmx) = (offset - width/<NUM_LIT:2>, offset + width/<NUM_LIT:2>)<EOL>F = piecewise(scale,<EOL>((-np.inf, xmn), <NUM_LIT:0>),<EOL>((xmn,xmx), scale/<NUM_LIT:2> * (<NUM_LIT:1> + cos(np.pi*(<NUM_LIT:0.5> - (identity - offset)/width)))))<EOL>if   is_const_potential(f):    return const_potential(F.value(f.c))<EOL>elif is_identity_potential(f): return F<EOL>else:                          return compose(F, f)<EOL>
cos_edge() yields a potential function g(x) that calculates 0 for x < pi/2, 1 for x > pi/2, and
  0.5*(1 + cos(pi/2*(1 - x))) for x between -pi/2 and pi/2.

The full formulat of the cosine well is, including optional arguments:
  scale/2 * (1 + cos(pi*(0.5 - (x - offset)/width)

The following optional arguments may be given:
  * width (default: pi) specifies that the frequency of the cos-curve should be pi/width; the
    width is the distance between the points on the cos-curve with the value of 1.
  * offset (default: 0) specifies the offset of the minimum value of the coine curve on the
    x-axis.
  * scale (default: 1) specifies the height of the cosine well.