# [Numpy-discussion] Combining Sigmoid Curves

Rich Shepard rshepard@appl-ecosys....
Fri May 2 14:49:36 CDT 2008

```   When I last visited I was given excellent advice about Gaussian and other
bell-shaped curves. Upon further reflection I realized that the Gaussian
curves will not do; the curve does need to have y=0.0 at each end.

I tried to apply a Beta distribution, but I cannot correlate the alpha and
beta parameters with the curve characteristics that I have.

What will work (I call it a pi curve) is a matched pair of sigmoid curves,
the ascending curve on the left and the descending curve on the right. Using
the Boltzmann function for these I can calculate and plot each individually,
but I'm having difficulty in appending the x and y values across the entire
range. This is where I would appreciate your assistance.

The curve parameters passed to the function are the left end, right end,
and midpoint. The inflection point (where y = 0.5) is half-way between the
ends and the midpoint.

What I have in the function is this:

def piCurve(ll, lr, mid):
flexL = (mid - ll)/2.0
flexR = (lr - mid)/2.0
tau = (mid - ll)/10.0

x = []
y = []

xL = nx.arange(ll,mid,0.1)
for i in xL:
x.append(xL[i])
yL = 1.0 / (1.0 + nx.exp(-(xL-flexL)/tau))
for j in yL:
y.append(yL[j])

xR = nx.arange(mid,lr,0.1)
for i in xR:
x.append(xR[i])
yR = 1 - (1.0 / (1.0 + nx.exp(-(xR-flexR)/tau)))
for j in yR:
y.append(yR[j])

appData.plotX = x
appData.plotY = y

yL = 1.0 / (1.0 + nx.exp(-(x-flexL)/tau))
TypeError: unsupported operand type(s) for -: 'list' and 'float'

What is the appropriate way to generate two sigmoid curves so that the x
values range from the left end to the right end and the y values rise from
0.0 to 1.0 at the midpoint, then lower to 0.0 again?

Rich

```