DSPRelated.com
Forums

multiplication of large numbers using convolution

Started by mobi January 30, 2012
Clay <clay@claysturner.com> wrote:

(snip, I wrote)
>> It seems that pi has now been calculated to 10 trillion (1e13 for >> those in some other countries). &#4294967295;If you google for it, you should >> find some explanation on how they do it. A fair amount of the time >> is the binary to decimal conversion, which uses a lot of multiplication.
>> Interestingly, there is an algorithm that will give specific base 16 >> digits of pi without computing all the digits in between. That is used >> to help verify the calculation done using other methods.
(snip)
> I recall Borwein's formula that picks out digits of pi in base 16. I > don't think they (Borwein and Borwein) have found a base 10 version of > the digit selector formula.
Yes. It would be interesting to have a base 10 version, but having a base 16 version is surprising enough. It seems that there are enough sources of undetected errors in the trillions of digit calculations that tests along the way are useful. The base 16 digits provide an independent test for the binary representation. Then all they need to do is verify that no errors occur in the binary to decimal conversion. -- glen
On Jan 30, 2:00&#4294967295;pm, glen herrmannsfeldt <g...@ugcs.caltech.edu> wrote:
> Clay <c...@claysturner.com> wrote: > > (snip, I wrote) > > >> It seems that pi has now been calculated to 10 trillion (1e13 for > >> those in some other countries). &#4294967295;If you google for it, you should > >> find some explanation on how they do it. A fair amount of the time > >> is the binary to decimal conversion, which uses a lot of multiplication. > >> Interestingly, there is an algorithm that will give specific base 16 > >> digits of pi without computing all the digits in between. That is used > >> to help verify the calculation done using other methods. > > (snip) > > > I recall Borwein's formula that picks out digits of pi in base 16. I > > don't think they (Borwein and Borwein) have found a base 10 version of > > the digit selector formula. > > Yes. It would be interesting to have a base 10 version, but having > a base 16 version is surprising enough. > > It seems that there are enough sources of undetected errors in the > trillions of digit calculations that tests along the way are useful. > > The base 16 digits provide an independent test for the binary > representation. Then all they need to do is verify that no errors > occur in the binary to decimal conversion. > > -- glen
It is indeed a very suprising result. I think I 1st saw it in a Science News mag years ago. It was one of those things that make you go "hmmmm." Clay

"Jerry Avins"  wrote in message news:L9BVq.4535$wR2.2330@newsfe01.iad...

On 1/30/2012 12:57 PM, dvsarwate wrote:
> On Jan 30, 12:18 pm, Jerry Avins<j...@ieee.org> demanded: > >> How would _you_ represent 200! ? > > I have never thought about the question, but I do see the > becessity of being able to compute 200! and similar large > numbers so that I can calculate, for example, the probability > of one Head when a fair coin is tossed 200 times. From the > formula in my book, I know that I have to calculate > [200!/199!1!]2^{-200} but I am having difficulty doing this > in MATLAB which will not evaluate 200! and 199! for me. So, > I cannot get the answer given in the back of the book which > says the probability is 25*2^{-203}. Can you help? :-)
I think I can help. My handy-dandy bignum package gives 200!/199! as 200, surprisingly enough. Computers are great! Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295; I suspect Jerry simply realized that 200! = 200 * 199! :-) Back in the 80's I attended am Engineer's Week meeting in Pittsfield, MA. One fellow there had a program written in BASIC for the Commodore 64 that calculated and printed out 1000! It basically stored the numbers as a string and did a multiplication as the OP described. The author said it took 3 days of run time. With a modern computer running LISP or some other language that handles bignums, I can't get my finger off the enter key before the number prints out. Best wishes, --Phil Martel
On 1/30/2012 9:57 PM, Phil Martel wrote:
> > > "Jerry Avins" wrote in message news:L9BVq.4535$wR2.2330@newsfe01.iad... > > On 1/30/2012 12:57 PM, dvsarwate wrote: >> On Jan 30, 12:18 pm, Jerry Avins<j...@ieee.org> demanded: >> >>> How would _you_ represent 200! ? >> >> I have never thought about the question, but I do see the >> becessity of being able to compute 200! and similar large >> numbers so that I can calculate, for example, the probability >> of one Head when a fair coin is tossed 200 times. From the >> formula in my book, I know that I have to calculate >> [200!/199!1!]2^{-200} but I am having difficulty doing this >> in MATLAB which will not evaluate 200! and 199! for me. So, >> I cannot get the answer given in the back of the book which >> says the probability is 25*2^{-203}. Can you help? :-) > > I think I can help. My handy-dandy bignum package gives 200!/199! as > 200, surprisingly enough. Computers are great! > > Jerry
> I suspect Jerry simply realized that 200! = 200 * 199! > Back in the 80's I attended am Engineer's Week meeting in Pittsfield, > MA. One fellow there had a program written in BASIC for the Commodore > 64 that calculated and printed out 1000! It basically stored the > numbers as a string and did a multiplication as the OP described. The > author said it took 3 days of run time. With a modern computer > running LISP or some other language that handles bignums, I can't get > my finger off the enter key before the number prints out. > Best wishes, > --Phil Martel I'm sure Dilip also realized it, and also that 1!=1. Jerry P.S. my sig has "-- " at the beginning of a line. That defines everything after it as not to be quoted. (But I have my little ways.) -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Most every computer algebra application has "arbitrary precision arithmetic," 
allowing you to compute with precision limited only by your computer's memory 
and speed. In many cases, they will give you an exact answer without any 
approximation at all.

DERIVE 6, for example, will be happy to tell you that 200! =
788657867364790503552363213932185062295135977687173263294742533244359449963403
342920304284011984623904177212138919638830257642790242637105061926624952829931
113462857270763317237396988943922445621451664240254033291864131227428294853277
524242407573903240321257405579568660226031904170324062351700858796178922222789
623703897374720000000000000000000000000000000000000000000000000

and it gets the answer so quickly that its built-in timer show 0.000 sec.

(in this case, the answer is exact.)

In article <21114453.1228.1327929773767.JavaMail.geo-discussion-
forums@vbbfd4>, mobien@gmail.com says...
>Hi all, >I figures out that the maximum number for which MATLAB can give an answer to >factorial is 170. This triggered a thought in my mind I want to share with
you guys.
>What if I take number in character string form as input to factorial, extract
the
>number sequence as number array use convolution to do multiplication and then
given
>the answer back in character? In this way the max range can be increased many
fold!
>I've two questions concerning the above problem, >1. Would such implementation be useful/beneficial to anyone? >2. Has it been done before? If yes what is it called?
In article <21114453.1228.1327929773767.JavaMail.geo-discussion-forums@vbbfd4>,
mobi  <comp.dsp@googlegroups.com> wrote:
>Hi all, > Figures out that the maximum number for which MATLAB can give an answer
to factorial is 170. This triggered a thought in my mind I want to share with you guys.
>What if I take number in character string form as input to factorial, extract
the number sequence as number array use convolution to do multiplication and then given the answer back in character? In this way the max range can be increased many fold!
>I've two questions concerning the above problem, >1. Would such implementation be useful/beneficial to anyone? >2. Has it been done before? If yes what is it called?
A trivial program in Python, easily gives me factorial(17000) after a few seconds wait. I don't have the patience to see how far it goes. Then there are bc and dc in unices. So? Groetjes Albert P.S. Please limit usenet postings to 72 chars. -- -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
So? 
How python gets it done in actual. Whats the method?