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@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@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
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@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@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
thanks martin, this seems to work and is roughly what i need-
what is the best way to write this into an array? is there a way to send a table an eqation other than cosinesum etc. using [tabwrite] always seems to have gaps...
thanks
pete
Martin Peach wrote:
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@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@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
Le 05-11-09, à 14:14, pete mcpartlan a écrit :
thanks martin, this seems to work and is roughly what i need-
what is the best way to write this into an array? is there a way to send a table an eqation other than cosinesum etc. using [tabwrite] always seems to have gaps...
thanks
pete
Hi Pete, try the following patch (copy-paste it in a text file gaussian.pd):
It needs maybe a unique id, though, needs to be perfected a bit. Also, I dont know why the first and last indexes give "number + ", which stands for somewhat infinite....
alex
#N canvas 259 119 585 430 10; #N canvas 0 0 1064 601 graph1 0; #X array tab-gaussian 515 float 3; #A 0 3.7649e-05 0 3.7649e-05 0.00015059 0.000338807 0.000602271 0.000940942 0.00135477 0.00184369 0.00240763 0.00304651 0.00376023 0.00454867 0.00541174 0.00634928 0.00736117 0.00844724 0.00960734 0.0108413 0.0121489 0.01353 0.0149843 0.0165117 0.0181119 0.0197847 0.0215298 0.0233469 0.0252359 0.0271963 0.0292279 0.0313304 0.0335035 0.0357469 0.0380602 0.040443 0.0428951 0.0454159 0.0480053 0.0506627 0.0533878 0.0561801 0.0590393 0.0619649 0.0649564 0.0680135 0.0711356 0.0743223 0.0775731 0.0808875 0.0842651 0.0877052 0.0912074 0.0947712 0.0983961 0.102081 0.105827 0.109631 0.113495 0.117416 0.121395 0.125432 0.129524 0.133673 0.137876 0.142134 0.146446 0.150812 0.155229 0.159699 0.16422 0.168792 0.173413 0.178084 0.182803 0.18757 0.192384 0.197244 0.20215 0.207101 0.212096 0.217134 0.222215 0.227337 0.232501 0.237705 0.242948 0.24823 0.253551 0.258908 0.264301 0.26973 0.275194 0.280691 0.286222 0.291785 0.297379 0.303004 0.308658 0.314341 0.320052 0.32579 0.331555 0.337344 0.343159 0.348997 0.354857 0.36074 0.366643 0.372567 0.378509 0.38447 0.390449 0.396444 0.402454 0.408479 0.414518 0.42057 0.426634 0.432709 0.438794 0.444888 0.450991 0.457101 0.463217 0.469339 0.475466 0.481596 0.487729 0.493864 0.499999 0.506135 0.51227 0.518403 0.524533 0.53066 0.536782 0.542898 0.549008 0.55511 0.561205 0.56729 0.573364 0.579428 0.58548 0.591519 0.597544 0.603555 0.60955 0.615528 0.621489 0.627432 0.633356 0.639259 0.645142 0.651002 0.65684 0.662654 0.668444 0.674209 0.679947 0.685658 0.691341 0.696995 0.70262 0.708214 0.713777 0.719307 0.724805 0.730269 0.735698 0.741091 0.746448 0.751768 0.757051 0.762294 0.767498 0.772662 0.777784 0.782865 0.787903 0.792898 0.797849 0.802755 0.807615 0.812429 0.817196 0.821915 0.826586 0.831207 0.835779 0.8403 0.84477 0.849187 0.853553 0.857865 0.862123 0.866326 0.870475 0.874568 0.878604 0.882583 0.886505 0.890368 0.894173 0.897918 0.901603 0.905228 0.908792 0.912294 0.915734 0.919112 0.922426 0.925677 0.928864 0.931986 0.935043 0.938035 0.94096 0.943819 0.946612 0.949337 0.951994 0.954584 0.957104 0.959556 0.961939 0.964253 0.966496 0.968669 0.970772 0.972803 0.974764 0.976653 0.97847 0.980215 0.981888 0.983488 0.985015 0.98647 0.987851 0.989158 0.990392 0.991553 0.992639 0.99365 0.994588 0.995451 0.99624 0.996953 0.997592 0.998156 0.998645 0.999059 0.999398 0.999661 0.999849 0.999962 1 0.999962 0.999849 0.999661 0.999398 0.999059 0.998645 0.998156 0.997593 0.996954 0.99624 0.995452 0.994588 0.993651 0.992639 0.991553 0.990393 0.989159 0.987851 0.98647 0.985016 0.983489 0.981888 0.980216 0.978471 0.976653 0.974765 0.972804 0.970773 0.96867 0.966497 0.964254 0.96194 0.959558 0.957105 0.954585 0.951995 0.949338 0.946613 0.943821 0.940961 0.938036 0.935044 0.931987 0.928865 0.925678 0.922428 0.919113 0.915736 0.912296 0.908793 0.90523 0.901605 0.897919 0.894174 0.89037 0.886506 0.882585 0.878605 0.874569 0.870477 0.866328 0.862125 0.857867 0.853555 0.849189 0.844772 0.840302 0.835781 0.831209 0.826588 0.821917 0.817198 0.812431 0.807617 0.802757 0.797851 0.7929 0.787906 0.782867 0.777787 0.772664 0.7675 0.762296 0.757053 0.751771 0.746451 0.741093 0.7357 0.730271 0.724807 0.71931 0.713779 0.708216 0.702622 0.696998 0.691343 0.68566 0.679949 0.674211 0.668447 0.662657 0.656843 0.651005 0.645144 0.639262 0.633358 0.627435 0.621492 0.615531 0.609552 0.603558 0.597547 0.591522 0.585483 0.579431 0.573367 0.567292 0.561207 0.555113 0.549011 0.542901 0.536784 0.530662 0.524536 0.518406 0.512273 0.506138 0.500002 0.493866 0.487731 0.481598 0.475468 0.469342 0.46322 0.457103 0.450993 0.444891 0.438797 0.432712 0.426637 0.420573 0.414521 0.408482 0.402457 0.396446 0.390451 0.384473 0.378512 0.372569 0.366646 0.360742 0.35486 0.348999 0.343161 0.337347 0.331557 0.325793 0.320054 0.314343 0.30866 0.303006 0.297381 0.291787 0.286224 0.280694 0.275196 0.269733 0.264304 0.25891 0.253553 0.248233 0.242951 0.237707 0.232503 0.227339 0.222217 0.217136 0.212098 0.207103 0.202152 0.197246 0.192386 0.187572 0.182805 0.178086 0.173415 0.168794 0.164222 0.159701 0.155231 0.150814 0.146448 0.142136 0.137878 0.133674 0.129526 0.125433 0.121397 0.117418 0.113496 0.109633 0.105828 0.102083 0.0983977 0.0947728 0.091209 0.0877067 0.0842665 0.080889 0.0775745 0.0743237 0.0711369 0.0680148 0.0649577 0.0619661 0.0590405 0.0561813 0.053389 0.0506638 0.0480064 0.045417 0.0428961 0.0404441 0.0380612 0.0357479 0.0335045 0.0313314 0.0292288 0.0271972 0.0252367 0.0233477 0.0215306 0.0197854 0.0181126 0.0165124 0.014985 0.0135306 0.0121495 0.0108418 0.00960786 0.00844773 0.00736162 0.0063497 0.00541213 0.00454903 0.00376055 0.0030468 0.00240789 0.00184392 0.00135496 0.000941105 0.000602401 0.000338905 0.000150656 3.76816e-05 7.04153e-12 3.76165e-05; #X coords 0 1 515 0 200 140 1; #X restore 323 18 graph; #X obj 42 28 loadbang; #X obj 119 249 tabread tab-gaussian; #X floatatom 130 298 5 0 0 0 - - -; #X obj 114 151 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 12700 1; #X obj 188 292 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X obj 26 132 inlet; #X obj 60 315 outlet; #X obj 118 225 div 1; #X msg 36 62 ; tab-gaussian cosinesum 512 0.5 -0.5; #X msg 46 93 ; tab-gaussian cosinesum 512 0.5 0.5; #X obj 118 200 * 515; #X connect 1 0 9 0; #X connect 2 0 3 0; #X connect 2 0 5 0; #X connect 2 0 7 0; #X connect 4 0 11 0; #X connect 6 0 11 0; #X connect 8 0 2 0; #X connect 11 0 8 0;
Are you using [until] to feed a counter, or have you been using [line]? I had this problem too until I realized the problem wasn't [tabwrite], it was [line]. Try something like:
[512(
|
[until]
|
[f]X[+ 1]
|
[f(x)]
|
[tabwrite yourtable]
assuming your table's been resized to 512
homepage: http://www.davidgolightly.net
From: pete mcpartlan petemcpartlan@yahoo.co.uk To: Martin Peach martinrp@vax2.concordia.ca, pd-list pd-list@iem.at Subject: Re: [PD] cumulative distribution? Date: Wed, 09 Nov 2005 19:14:23 +0000
thanks martin, this seems to work and is roughly what i need-
what is the best way to write this into an array? is there a way to send a table an eqation other than cosinesum etc. using [tabwrite] always seems to have gaps...
thanks
pete
Martin Peach wrote:
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@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@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
--
www.140worthing.karoo.net =-=-=-=-=-=-=-=-=-=-=-=-= _______________________________________________ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hallo, pete mcpartlan hat gesagt: // pete mcpartlan wrote:
thanks martin, this seems to work and is roughly what i need-
what is the best way to write this into an array? is there a way to send a table an eqation other than cosinesum etc. using [tabwrite] always seems to have gaps...
See for example: http://royalrabbit.goto10.org/svn/goto10/pd-patches/fbar/tuts/gaussverteilun... for how to do a gaussian using the [expr] object (ignore the missing objects like rrad.scale)
Following the same idiom you can write everything to a table, that is possible to express with [expr].
Frank Barknecht _ ______footils.org_ __goto10.org__
Frank Barknecht wrote:
Hallo, pete mcpartlan hat gesagt: // pete mcpartlan wrote:
thanks martin, this seems to work and is roughly what i need-
what is the best way to write this into an array? is there a way to send a table an eqation other than cosinesum etc. using [tabwrite] always seems to have gaps...
See for example: http://royalrabbit.goto10.org/svn/goto10/pd-patches/fbar/tuts/gaussverteilun... for how to do a gaussian using the [expr] object (ignore the missing objects like rrad.scale)
Following the same idiom you can write everything to a table, that is possible to express with [expr].
Ciao
Nice. I changed it to work with tanh and variable horizontal scale. See attached patch.
Martin
#N canvas 243 252 372 382 10; #X obj 21 5 table x 515; #X text 106 5 size=512+3 for tabread4~; #X obj 24 324 tabwrite x; #X obj 24 178 f 0; #X obj 50 178 + 1; #X obj 24 202 t f f; #X obj 24 151 until; #X obj 24 71 t b b; #X msg 94 127 0; #X msg 24 98 515; #X obj 24 47 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 24 125 t f f; #X text 81 177 count 0 to tablesize; #X text 72 260 divide by tablesize to make expr happy.; #X obj 24 259 / 515; #X obj 1 234 - 257.5; #X obj 24 286 expr tanh($f2 * $f1); #X floatatom 123 236 5 0 0 0 - - -; #X obj 85 202 / 2; #X text 159 237 horizontal scale; #X obj 123 194 loadbang; #X msg 123 214 1; #X connect 3 0 4 0; #X connect 3 0 5 0; #X connect 4 0 3 1; #X connect 5 0 15 0; #X connect 5 1 2 1; #X connect 6 0 3 0; #X connect 7 0 9 0; #X connect 7 1 8 0; #X connect 8 0 3 1; #X connect 9 0 11 0; #X connect 10 0 7 0; #X connect 11 0 6 0; #X connect 11 1 14 1; #X connect 11 1 18 0; #X connect 14 0 16 0; #X connect 15 0 14 0; #X connect 16 0 2 0; #X connect 17 0 16 1; #X connect 18 0 15 1; #X connect 20 0 21 0; #X connect 21 0 17 0;
In fact I don't think you can compute the cumulative gaussian distribution from a closed formula...
i think that a sigmoid function might be better suited than the hyperbolic tangent.... take a look at http://en.wikipedia.org/wiki/Sigmoid_function for more. I'm not at home so can't open your patch; sorry if I have the wrong idea.
Best,
Jacob
On 11/9/05, pete mcpartlan petemcpartlan@yahoo.co.uk 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@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@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
--
www.140worthing.karoo.net =-=-=-=-=-=-=-=-=-=-=-=-= _______________________________________________ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Jacob Last wrote:
In fact I don't think you can compute the cumulative gaussian distribution from a closed formula...
You can.
i think that a sigmoid function might be better suited than the hyperbolic tangent.... take a look at http://en.wikipedia.org/wiki/Sigmoid_function for more.
The wiki article says: "Besides the logistic function, sigmoid functions include the ordinary arc-tangent http://en.wikipedia.org/wiki/Trigonometric_function, the hyperbolic tangent http://en.wikipedia.org/wiki/Hyperbolic_tangent, and the error function http://en.wikipedia.org/wiki/Error_function." The tanh and sigmoid are essentially the same thing. Practically it could represent the weight at successive times as you smoothly pour sand from a bucket onto a scale, or the number of photons captured from a pulse of light. which is what the cumulative gaussian distribution is about. atan is the same shape going along the y axis. You can multiply the argument of tanh by a constant to get different "sharpness" of the S, and multiply and add constants to position and scale it "vertically".
Martin
On Thu, 10 Nov 2005, Jacob Last wrote:
In fact I don't think you can compute the cumulative gaussian distribution from a closed formula...
It depends which are the allowed building blocks for the formula. If all you have is +,-,*,/,pow,exp,log,cos, then you can't.
then the MacLaurin expansion of integral(exp(-x*x)) is:
Sum of x(-x*x)^k / (k+1)! for k=0 and upwards
Which is a bitch to compute, since it needs so many terms to get it accurate.
However, <math.h> has a function erf() which computes exactly that, and it's prolly a good optimisation over computing the series naïvely.
i think that a sigmoid function might be better suited than the hyperbolic tangent....
The hyperbolic tangent *IS* a sigmoid!
tanh(t) = 1-2*P(-2*t)
Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju Freelance Digital Arts Engineer, Montréal QC Canada
On Thu, 10 Nov 2005, Mathieu Bouchard wrote:
then the MacLaurin expansion of integral(exp(-x*x)) is: Sum of x(-x*x)^k / (k+1)! for k=0 and upwards
D'oh. Instead it's:
Sum of x(-x*x)^k / (2k+1)(k!) for k=0 and upwards
Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju Freelance Digital Arts Engineer, Montréal QC Canada
hello,
i hope all this isnt for my benefit, i decided to just draw the graphs and shove them into message boxes, i only needed an array that had ten values, and this way i had more control over the individual actions (or consequences of actions) anyway... but thanks everyone for the help-- i'll put off learning any maths for a bit longer--
pete
Mathieu Bouchard wrote:
On Thu, 10 Nov 2005, Mathieu Bouchard wrote:
then the MacLaurin expansion of integral(exp(-x*x)) is: Sum of x(-x*x)^k / (k+1)! for k=0 and upwards
D'oh. Instead it's:
Sum of x(-x*x)^k / (2k+1)(k!) for k=0 and upwards
Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju Freelance Digital Arts Engineer, Montréal QC Canada