# [PD] cumulative distribution?

Martin Peach martinrp at vax2.concordia.ca
Wed Nov 9 19:13:17 CET 2005

```I think pete wants the hyberbolic tangent function.
You could try this kind of patch:

[-10.01(
|
[-10.01\
|
[expr tanh(\$f1)]
|
[-1\

..where you click on the message box and then shift-drag the number box
upwards to see how the result goes from almost -1 to almost +1 with a
sharp rise around 0.0 as you go from -10 to +10.
To get 0-1 output range you just add 1 then multiply by 0.5.

Martin

pete mcpartlan wrote:

> cdf i think, when i said flat at both ends i meant horizontal. so
> yeah, an s curve not a bell curve-
>
> so yes cumulative gaussian distibution -i think...
>
> sorry to clog up the list with my mathematic incompetency, but how do
> i integrate the pdf?
>
> thanks
>
> pete
>
> Charles Henry wrote:
>
>> hold on...what kind of distribution are you looking for?  the
>> expression is pdf for a probability density function that flattens out
>> at both ends.  the cdf (cumulative density) is obtained by integrating
>> the pdf-this is the stretched 's'
>> Simulating random variables by the inversion method involves taking
>> the integral of your chosen pdf, and putting the values in a table.
>> Then you can pick numbers between 0 and 1 and look up the random
>> variable's value.  So, what distribution do you want?
>>
>> Chuck
>>
>> On 11/9/05, pete mcpartlan <petemcpartlan at yahoo.co.uk> wrote:
>>
>>
>>> thanks Tebjan,
>>>
>>> but...its not half a cosine because it has to flatten out at both ends.
>>>
>>> and secondly i have no idea how to take an equation like that and
>>> implement that in pd... maybe i didnt explain that i'm not too good at
>>> all that maths stuff...
>>>
>>> thanks,
>>>
>>> pete
>>>
>>> Tebjan Halm wrote:
>>>
>>>
>>>
>>>>>> (cos(x) + 1) * c with x inside the range -Pi to 0 and c is a
>>>>>> constant
>>>>>> that defines the output range of the curve 0 to c ...
>>>>>>
>>>>>
>>>> sorry, the output range will be 0 to 2*c ... because the cos range -1
>>>> to 1
>>>> gets shifted upwards by the +1 to 0..2 and c scales this range ...
>>>>
>>>> pete mcpartlan schrieb:
>>>>
>>>>
>>>>
>>>>> hello,
>>>>>
>>>>> i need help with a maths problem... i am trying to plot a cumulative
>>>>> distribution curve to weight random. I have a [random] that feeds
>>>>> into a chain of [moses], sililar to the markov chain example but what
>>>>> i want to do is have a table dump into the right inlet of each moses
>>>>> changing the weighting. so far so good. what i need help with is the
>>>>> curve which needs to make it more likely for the next result to be
>>>>> near the  same position. the attatched patch has an array with the
>>>>> sort of function it should be... like an s stetched at both ends...
>>>>> is there a way i can do this with expr? or am i going to have to type
>>>>> out a list for each state? i'm sure this is probably quite a simple
>>>>> maths problem... but beyond me... or other ideas? might it be simpler
>>>>> to have a longer array with the curve is then plotted at different
>>>>> points back into the array... but considering i'm probably going to
>>>>> have 16+ of these and other stuff i want to make it as simple as
>>>>> possible....
>>>>>
>>>>> thanks in advance and apologies for rambling a bit..
>>>>>
>>>>> pete
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~
>>> www.140worthing.karoo.net
>>> =-=-=-=-=-=-=-=-=-=-=-=-=
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> PD-list at iem.at mailing list
>>> UNSUBSCRIBE and account-management ->
>>> http://lists.puredata.info/listinfo/pd-list
>>>
>>>
>>
>>
>>
>> --
>> Charles Zachary Henry
>>
>> anti.dazed.med
>> Med student who needs a Mickey's
>>
>>
>>
>

```