[Numpy-discussion] Combining Sigmoid Curves

Rich Shepard rshepard at appl-ecosys.com
Fri May 2 19:10:15 EDT 2008


On Fri, 2 May 2008, Christopher Barker wrote:

> Why not just scale to -pi to pi right there?

   Dunno, Chris. As I wrote to Anne (including a couple of files and the
resulting plot), it's been almost three decades since I dealt with the math
underlying distribution functions.

> Which is why you want linspace, rather than arange. Really, trust me on
> this!

   I see the difference in the book. Didn't know about linspace(), but adding
True brings the end point to 100.0

> If the cosine curve isn't right for you, a little create use of np.where
> would let you do what you want in maybe another line or two of code.
> Something like:
>
> y = np.where( x < 0 , Leftfun(x), Rightfun(x) )
>
> or just compute one side and then flip it to make the other side:
>
> y = np.zeros_like(x)
> y[center:] = fun(x[center:])
> y[:center] = y[center+1:][::-1] # don't want the center point twice
>
> if it's symetric anyway.

   I'll look into this over the weekend (after upgrading my machines to
Slackware-12.1). I can get nice sigmoid curves with the Boltzmann function.
This thread started when I asked how to combine the two into a single curve
with one set of x,y points.

Much appreciated,

Rich

-- 
Richard B. Shepard, Ph.D.               |  Integrity            Credibility
Applied Ecosystem Services, Inc.        |            Innovation
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863



More information about the NumPy-Discussion mailing list