comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Fast way to calculate sum of discrete poisson distribution
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Fast way to calculate sum of discrete poisson distribution [message #52724] Sat, 24 February 2007 15:12
Jonathan Dursi is currently offline  Jonathan Dursi
Messages: 9
Registered: November 2006
Junior Member
On Feb 24, 4:10 pm, b...@kaifler.net wrote:
> I have been struggeling with this for a while. Basically I need to
> calculate the quadratic sum of the discrete poisson distribution:
>
> k = INDGEN(8)
>
> sum = TOTAL( p^k / FACTORIAL(k) * EXP(-p) * k^2 )
>
> This workes fine for a scalar p. Is there a way to calculate the
> quadratic sum for every element of an array p without using a loop?

So something like this seems to work:

IDL> k = rebin(indgen(8),8,3)
IDL> p = transpose(rebin([.1,.4,.9],3,8))
IDL> print, k
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
IDL> print, p
0.100000 0.100000 0.100000 0.100000 0.100000
0.100000 0.100000 0.100000
0.400000 0.400000 0.400000 0.400000 0.400000
0.400000 0.400000 0.400000
0.900000 0.900000 0.900000 0.900000 0.900000
0.900000 0.900000 0.900000

IDL> sum = total(p^k/factorial(k)*exp(-p)*k^2,1)
IDL> print, sum
0.11000000 0.55999927 1.7096826

- Jonathan
--
ljdursi@gmail.com
http://www.cita.utoronto.ca/~ljdursi.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Fast way to calculate sum of discrete poisson distribution
Next Topic: how can i use envi in batch mode to build mask from EVFs

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:13:46 PDT 2025

Total time taken to generate the page: 0.00584 seconds