help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use GNU MP in octave?


From: Mike Miller
Subject: Re: How to use GNU MP in octave?
Date: Tue, 24 May 2005 09:04:36 -0500 (CDT)

On Tue, 24 May 2005, Javier Arantegui wrote:

Let x = lg(8600!). Since lg(xy)=lg(x)+lg(y) you have

x = sum(lg(k),k=1..86000)

Define floor(x) as the integer part of x. Then

86000! = 10^(x-floor(x))*10^floor(x).

You can evaluate x to the degree of accuracy you want, for example,
using Maple I got:

86000! = 7.91222558*10^372239

Unfortunately, Octave doesn't buy the trick :-(:-(

octave:4> k=1:1:86000;
octave:5> x=sum(log10(k))
x =  3.8702e+05
octave:6> 10^(x-floor(x))*10^floor(x)
ans = Inf


octave:2> format long
octave:3> X=1000;
octave:4> Y=sum(log10([1:X]))
Y = 2567.60464422213
octave:5> exponent=floor(Y)
exponent = 2567
octave:6> coeff = 10^(Y-floor(Y))
coeff = 4.02387260074868

Therefore, 1000! = 4.02387260074868 x 10^2567

Does that make sense? Octave produces the coefficient and the exponent for you and you put them together.

If you want more precision, check this out:

http://maxima.sourceforge.net/

Mike

reply via email to

[Prev in Thread] Current Thread [Next in Thread]