On Sat, 27 Nov 2010 15:44:38 -0800, casevh wrote:
> I think most users are expecting infinite precision when they use
> rationals. Trying to explain limited precision rational arithmetic might
> be interesting.
Most users are expecting infinite precision decimals when they use
floats, and get su
On Nov 27, 3:08 pm, Steven D'Aprano wrote:
> On Fri, 26 Nov 2010 19:21:47 -0800, casevh wrote:
> > On Nov 26, 2:11 pm, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote:
> >> On Fri, 26 Nov 2010 12:54:12 -0800, John Nagle wrote:
> >> > For ordinary number crunching,
> >> > rational arithme
On Fri, 26 Nov 2010 19:21:47 -0800, casevh wrote:
> On Nov 26, 2:11 pm, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote:
>> On Fri, 26 Nov 2010 12:54:12 -0800, John Nagle wrote:
>> > For ordinary number crunching,
>> > rational arithmetic is completely inappropriate.
>>
>> Why?
>>
>> --
>>
On Nov 27, 4:00 am, m...@distorted.org.uk (Mark Wooding) wrote:
> casevh writes:
> > I coded a quick matrix inversion function and measured running times
> > using GMPY2 rational and floating point types. For the floating point
> > tests, I used a precision of 1000 bits. With floating point values
casevh writes:
> I coded a quick matrix inversion function and measured running times
> using GMPY2 rational and floating point types. For the floating point
> tests, I used a precision of 1000 bits. With floating point values,
> the running time grew as n^3. With rational values, the running tim
On Nov 26, 2:11 pm, Steven D'Aprano wrote:
> On Fri, 26 Nov 2010 12:54:12 -0800, John Nagle wrote:
> > For ordinary number crunching,
> > rational arithmetic is completely inappropriate.
>
> Why?
>
> --
> Steven
As you perform repeated calculations with rationals, the size of the
values (usually)
On Fri, 26 Nov 2010 12:54:12 -0800, John Nagle wrote:
> For ordinary number crunching,
> rational arithmetic is completely inappropriate.
Why?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On 11/24/2010 10:30 AM, Robert Kern wrote:
On 11/24/10 12:07 PM, Daniel Fetchinson wrote:
The whole story is that I have a matrix A and matrix B both of which
have rational entries and they both have pretty crazy entries too.
Their magnitude spans many orders of magnitude, but inverse(A)*B is a
On Nov 25, 1:28 pm, Daniel Fetchinson
wrote:
> Okay, I see your point and I completely agree.
> Surely it will be faster to do it with integers, will give it a shot.
>
> Cheers,
> Daniel
>
> --
> Psss, psss, put it down! -http://www.cafepress.com/putitdown
You may want to look at using GMPY. GMP
>> > I wouldn't do it that way. Let M be your matrix. Work out the LCM l of
>> > the denominators, and multiply the matrix by that to make it an integer
>> > matrix N = l M. Then work out the determinant d of that integer matrix.
>> > Next, the big step: use Gaussian elimination to find a matrix
Daniel Fetchinson writes:
> > I wouldn't do it that way. Let M be your matrix. Work out the LCM l of
> > the denominators, and multiply the matrix by that to make it an integer
> > matrix N = l M. Then work out the determinant d of that integer matrix.
> > Next, the big step: use Gaussian elim
On 11/24/10 12:30 PM, Robert Kern wrote:
On 11/24/10 12:07 PM, Daniel Fetchinson wrote:
The whole story is that I have a matrix A and matrix B both of which
have rational entries and they both have pretty crazy entries too.
Their magnitude spans many orders of magnitude, but inverse(A)*B is an
>> So after all I might just code the inversion via Gauss elimination
>> myself in a way that can deal with fractions, shouldn't be that hard.
>
> I wouldn't do it that way. Let M be your matrix. Work out the LCM l of
> the denominators, and multiply the matrix by that to make it an integer
> mat
Daniel Fetchinson writes:
> So after all I might just code the inversion via Gauss elimination
> myself in a way that can deal with fractions, shouldn't be that hard.
I wouldn't do it that way. Let M be your matrix. Work out the LCM l of
the denominators, and multiply the matrix by that to mak
On 11/24/10 12:07 PM, Daniel Fetchinson wrote:
The whole story is that I have a matrix A and matrix B both of which
have rational entries and they both have pretty crazy entries too.
Their magnitude spans many orders of magnitude, but inverse(A)*B is an
okay matrix and I can deal with it using f
>> It's a mathematical problem so no uncertainty is present in the
>> initial values. And even if there was, if there are many orders of
>> magnitude differences between the entries in the matrix floating point
>> does not suffice for various things like eigenvalue calculation and
>> stuff like tha
>> I'm using fractions.Fraction as entries in a matrix because I need to
>> have very high precision and fractions.Fraction provides infinite
>> precision . . .
>>
>> Probably it doesn't matter but the matrix has all components non-zero
>> and is about a thousand by thousand in size.
>
> I wonder h
I guess this is a question to folks with some numpy background (but
not necessarily).
I'm using fractions.Fraction as entries in a matrix because I need to
have very high precision and fractions.Fraction provides infinite
precision (as I've learned from advice from thi
On 11/24/10 9:10 AM, Daniel Fetchinson wrote:
It's a mathematical problem so no uncertainty is present in the
initial values. And even if there was, if there are many orders of
magnitude differences between the entries in the matrix floating point
does not suffice for various things like eigenva
On Wed, 24 Nov 2010 14:02:21 +0100, Daniel Fetchinson wrote:
[snip]
> I'm using fractions.Fraction as entries in a matrix because I need to
> have very high precision and fractions.Fraction provides infinite
> precision . . .
[snip]
>
> Probably it doesn't matter but the matrix has all components n
Daniel Fetchinson wrote:
>>> I guess this is a question to folks with some numpy background (but
>>> not necessarily).
>>>
>>> I'm using fractions.Fraction as entries in a matrix because I need to
>>> have very high precision and fractions.Fraction provides infinite
>>> precision (as I've learned
>> I guess this is a question to folks with some numpy background (but
>> not necessarily).
>>
>> I'm using fractions.Fraction as entries in a matrix because I need to
>> have very high precision and fractions.Fraction provides infinite
>> precision (as I've learned from advice from this list).
>
>
Daniel Fetchinson wrote:
> I guess this is a question to folks with some numpy background (but
> not necessarily).
>
> I'm using fractions.Fraction as entries in a matrix because I need to
> have very high precision and fractions.Fraction provides infinite
> precision (as I've learned from advice
I guess this is a question to folks with some numpy background (but
not necessarily).
I'm using fractions.Fraction as entries in a matrix because I need to
have very high precision and fractions.Fraction provides infinite
precision (as I've learned from advice from this list). Now I need to
calcul
24 matches
Mail list logo