tag:blogger.com,1999:blog-9318222.post113186340453101548..comments2024-03-28T20:17:18.271-07:00Comments on Connelly - Technical: FFT polynomial multiplicationConnelly Barneshttp://www.blogger.com/profile/02568908952592933174noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-9318222.post-9434823419498459032011-02-21T08:08:29.000-08:002011-02-21T08:08:29.000-08:00I remember that once I tried to made a new calcula...I remember that once I tried to made a new calculator for times of the employes to <a href="http://www.iservepharmacy.com" rel="nofollow">Viagra Online</a> labs and the source code it's very simple you don't need to made a lot of lines for that.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-9318222.post-34925171076758368732010-09-15T13:49:09.221-07:002010-09-15T13:49:09.221-07:00what a good method and I wondered the same Yarosla...what a good method and I wondered the same Yaroslav, after reading this great post I asked myself if this method could also be applied to finding sums of random variables. If it could, it would be awesome!Sildenafilhttp://www.citratesildenafil.com/noreply@blogger.comtag:blogger.com,1999:blog-9318222.post-80987115778012600872009-11-17T08:21:42.263-08:002009-11-17T08:21:42.263-08:00Hi
I tried to add from Numeric import *
but it st...Hi<br /><br />I tried to add from Numeric import *<br />but it still complains that it can't find FFT.alekdarnoreply@blogger.comtag:blogger.com,1999:blog-9318222.post-50597567832174595722008-03-23T05:33:00.000-07:002008-03-23T05:33:00.000-07:00FFT approach for finding convolution is indeed eff...FFT approach for finding convolution is indeed efficient but natural questions arises: what can be said about the error of this approximation. This is of course an approximation due to the representation of the numbers in computer arithmetic (in theory it should be exact). Since computation of the convolution using FFT is fast many you may use very long sequences but what about the round-off errors then? Do you know some sources in which one can find something about the error?Unknownhttps://www.blogger.com/profile/18172638984641373036noreply@blogger.comtag:blogger.com,1999:blog-9318222.post-1132016243315174972005-11-14T16:57:00.000-08:002005-11-14T16:57:00.000-08:00You can also take polynomial square roots and mult...You can also take polynomial square roots and multiply integers in this way. The NTT does it in exact integer arithmetic, or you can round the floating point results and rely on error bounds proved for IEEE-style floating point arithmetic.Connelly Barneshttps://www.blogger.com/profile/02568908952592933174noreply@blogger.comtag:blogger.com,1999:blog-9318222.post-1131937518295433272005-11-13T19:05:00.000-08:002005-11-13T19:05:00.000-08:00You're right about the IID distribution convolutio...You're right about the IID distribution convolutions. You can compute your distribution convolution with the fft_mul() code I gave.<BR/><BR/>>>> fft_mul([0.6, 0.3, 0.1], [0.8, 0.2])<BR/>[0.48, 0.36, 0.14, 0.02]<BR/><BR/>The reason it works is because the polynomial coefficients of c(x) = a(x)*b(x) are:<BR/><BR/>c[0] = a[0]*b[0]<BR/>c[1] = a[0]*b[1]+a[1]*b[0]<BR/>c[2] = a[0]*b[2]+a[1]*b[1]+a[2]*b[0]<BR/>...<BR/><BR/>That is, c[k] is the sum of all a[i] and b[j] such that i + j = k. Which is just P(X1+X2=k).<BR/><BR/>---<BR/><BR/>For integral transforms with an arbitrary kernel, you can just follow the proof of the <A HREF="http://mathworld.wolfram.com/ConvolutionTheorem.html" REL="nofollow">convolution theorem</A> to establish a sufficient condition on the kernel such that a star b = T(a)T(b).<BR/><BR/>I recall from Math 256 that analytic inverse Laplace transforms are usually impossible if you can't find them in some CRC type handbook. But apparently they can be done numerically.Connelly Barneshttps://www.blogger.com/profile/02568908952592933174noreply@blogger.comtag:blogger.com,1999:blog-9318222.post-1131931513174986272005-11-13T17:25:00.000-08:002005-11-13T17:25:00.000-08:00Interesting post,I wonder if this method could als...Interesting post,<BR/><BR/>I wonder if this method could also be applied to finding sums of random variables.<BR/><BR/>For instance to get this picture(http://web.engr.oregonstate.edu/~bulatov/research/reports/vapnik/plot2.png), I had to get distributions of X1, X1+X2, X1+X2+X3+...+Xl Where X_i are IID variables.<BR/><BR/>You find this distribution using convolution. If we have P(X=k), then P(X1+X2)=k is <BR/><BR/>P(X=0)P(X=k)+P(X=1)P(X=k-1)+....<BR/><BR/>Which is really a convolution. So if a[k] gives P(X=k), then convolve(a,a)[k] will P(X1+X2)=k; def convolve(a,b)=[sum([a[j]*b[i-j] for j in range(0,i+1)]) for i in range(len(a))]<BR/><BR/>You can repeat the convolution l-1 times to get the sum of X1+...+Xl<BR/><BR/>The problem is that this gets really slow.<BR/><BR/>----<BR/><BR/>In statistics there's method for finding sums called "Method of Moments". They take two-sided Laplace transform of the probability density (which is called the Moment Generating Function http://en.wikipedia.org/wiki/Moment_generating_function),<BR/>and then convolutions of the densities become products.<BR/><BR/>So apparently Fourier transform isn't the only one where convolutions become products...<BR/><BR/>Is there some general theorem which says that convolutions turn into products for X,Y and Z transforms?<BR/><BR/>Curiously, in statistics books the inverse of the transform is done by "guess and check"...is the inverse transform really that hard?<BR/><BR/>Interestingly some proofs of the Central Limit Theorem operate the transformed space. IE, it's hard to see what'll happen if you take X1+X2+X3+....\infty if you viewing it as convolutions (ie, how exactly are you going to do the infinite dimensional integral?!?), but instead if you look at it as infinite product, it's easier. So it turns out that the infinite product converges to the same thing regardless of the thing you are multiplying, which could explain why people were so excited about Central Limit Theorem (http://www-stat.stanford.edu/~susan/courses/s116/node120.html)Yaroslav Bulatovhttps://www.blogger.com/profile/06139256691290554110noreply@blogger.com