Re: math module for Decimals

2008-12-29 Thread Raymond L. Buvel
Since the interest is more in extended precision than in decimal representation, there is another module that may be of interest. http://calcrpnpy.sourceforge.net/clnum.html It interfaces to the Class Library for Numbers (CLN) library to provide both arbitrary precision floating point and comp

Re: Using fractions instead of floats

2007-10-03 Thread Raymond L. Buvel
Neil Cerutti wrote: >> Another guess could be that real numbers being closed under the >> four arithmetic operations, there is no danger to accidentally >> step into complex numbers. OTOH floats and rationals are two >> (conflicting) ways of extending integers. > > You would have to adopt a few s

[ANN] rpncalc-2.5 RPN Calculator for Python

2006-11-19 Thread Raymond L. Buvel
The rpncalc package adds an interactive Reverse Polish Notation (RPN) interpreter to Python. This interpreter allows the use of Python as an RPN calculator. You can easily switch between the RPN interpreter and the standard Python interpreter. Home page: http://calcrpnpy.sourceforge.net/ Chang

[ANN] ratfun-2.4 Polynomials and Rational Functions

2006-11-19 Thread Raymond L. Buvel
The ratfun module provides classes for defining polynomial and rational function (ratio of two polynomials) objects. These objects can be used in arithmetic expressions and evaluated at a particular point. Home page: http://calcrpnpy.sourceforge.net/ratfun.html Note: If you are using rpncalc-1.2

[ANN] clnum-1.4 Class Library For Numbers Python Binding

2006-11-19 Thread Raymond L. Buvel
The clnum package adds rational numbers and arbitrary precision floating point numbers in real and complex form to Python. Also provides arbitrary precision floating point replacements for the functions in the math and cmath standard library modules. Home page: http://calcrpnpy.sourceforge.net/cln

Re: ratfun-2.3 Polynomials and Rational Functions

2006-08-19 Thread Raymond L. Buvel
Bas wrote: > Are there any differences between this module and the one already > present in numpy? > > http://www.scipy.org/doc/numpy_api_docs/numpy.lib.polynomial.html > > Cheers, > Bas > Yes, there are quite a few. This module uses a multi-precision library (clnum) to make the calculations m

[ANN] rpncalc-2.4 RPN Calculator for Python

2006-08-19 Thread Raymond L. Buvel
The rpncalc package adds an interactive Reverse Polish Notation (RPN) interpreter to Python. This interpreter allows the use of Python as an RPN calculator. You can easily switch between the RPN interpreter and the standard Python interpreter. Home page: http://calcrpnpy.sourceforge.net/ Chang

[ANN] ratfun-2.3 Polynomials and Rational Functions

2006-08-19 Thread Raymond L. Buvel
The ratfun module provides classes for defining polynomial and rational function (ratio of two polynomials) objects. These objects can be used in arithmetic expressions and evaluated at a particular point. Home page: http://calcrpnpy.sourceforge.net/ratfun.html Note: If you are using rpncalc-1.2

[ANN] clnum-1.3 Class Library For Numbers Python Binding

2006-08-19 Thread Raymond L. Buvel
The clnum package adds rational numbers and arbitrary precision floating point numbers in real and complex form to Python. Also provides arbitrary precision floating point replacements for the functions in the math and cmath standard library modules. Home page: http://calcrpnpy.sourceforge.net/cln

Re: math.pow(x,y)

2006-06-11 Thread Raymond L. Buvel
K.S.Sreeram wrote: > Raymond L. Buvel wrote: >> I just tried this and it is taking an extremely long time even on a fast >> machine with 4 Gb of RAM. Killed it after a couple of minutes. > > Thats odd. > 34564323**456356 completed on my laptop in 28 seconds. > [Pyt

Re: math.pow(x,y)

2006-06-11 Thread Raymond L. Buvel
Felipe Almeida Lessa wrote: > Em Dom, 2006-06-11 às 11:19 -0700, fl1p-fl0p escreveu: >> import math >> math.pow(34564323, 456356) >> >> will give math range error. >> >> how can i force python to process huge integers without math range >> error? Any modules i can use possibly? > > 34564323**45635

[ANN] clnum-1.2.1 Class Library For Numbers Python Binding

2006-06-11 Thread Raymond L. Buvel
The clnum package adds rational numbers and arbitrary precision floating point numbers in real and complex form to Python. Also provides arbitrary precision floating point replacements for the functions in the math and cmath standard library modules. Home page: http://calcrpnpy.sourceforge.net/cln

Re: Decimal and Exponentiation

2006-05-20 Thread Raymond L. Buvel
Tim Peters wrote: > [Raymond L. Buvel, on >http://calcrpnpy.sourceforge.net/clnumManual.html > ] > >> The clnum module handles this calculation very quickly: >> >> >>> from clnum import mpf >> >>> mpf("1e1") ** mpf("3.

Re: Decimal and Exponentiation

2006-05-20 Thread Raymond L. Buvel
Tim Peters wrote: > The GNU GMP library (for which Python bindings are available) also > supports "big floats", but their power operation is also restricted to > integer powers and/or exact roots. This can be painful even to try; > e.g., > >>>> from gmpy import mpf >>>> mpf("1e1") *

Re: Decimal and Exponentiation

2006-05-20 Thread Raymond L. Buvel
elventear wrote: > Hi, > > I am the in the need to do some numerical calculations that involve > real numbers that are larger than what the native float can handle. > > I've tried to use Decimal, but I've found one main obstacle that I > don't know how to sort. I need to do exponentiation with re

Re: installing numpy

2006-05-10 Thread Raymond L. Buvel
Gary Wessle wrote: > Robert Kern <[EMAIL PROTECTED]> writes: > > >>Raymond L. Buvel wrote: >> >> >>>Since you are a new Linux user, you should definitely follow Robert's >>>advice about building as an ordinary user separately from the

Re: installing numpy

2006-05-09 Thread Raymond L. Buvel
Robert Kern wrote: > Gary Wessle wrote: > >>"Raymond L. Buvel" <[EMAIL PROTECTED]> writes: > > >>>When installing from source on a Debian system, you want the installed >>>package to wind up in /usr/local/lib/python2.x/site-packages (where x

Re: installing numpy

2006-05-09 Thread Raymond L. Buvel
Gary Wessle wrote: > Hi > > I am trying to install NumPy in my debian/testing linux > 2.6.15-1-686. > When installing from source on a Debian system, you want the installed package to wind up in /usr/local/lib/python2.x/site-packages (where x represents the version of Python you are running th

Re: printing list

2006-05-07 Thread Raymond L. Buvel
compboy wrote: > How do you print elements of the list in one line? > > alist = [1, 2, 5, 10, 15] > > so it will be like this: > 1, 2, 5, 10, 15 > > because if I use this code > > for i in alist: > print i > > the result would be like this > > 1 > 2 > 5 > 10 > 15 > > Thanks. > There ar

Re: python rounding problem.

2006-05-07 Thread Raymond L. Buvel
Gary Wessle wrote: > Erik Max Francis <[EMAIL PROTECTED]> writes: > > >>chun ping wang wrote: >> >> >>>Hey i have a stupid question. >>>How do i get python to print the result in only three decimal >>>place... >>>Example>>> round (2.9954254, 3) >>>2.9951 >>>but i want to get r

Class Library for Numbers now available for Windows

2006-05-06 Thread Raymond L. Buvel
Due to the contribution of Frank Palazzolo, a Windows binary installer and build instructions are available for the clnum package. This also makes ratfun and rpncalc usable on the Windows platform. The clnum package adds rational numbers and arbitrary precision floating point numbers in real and c

[ANN] clnum-1.2 Class Library For Numbers Python Binding

2006-05-06 Thread Raymond L. Buvel
The clnum package adds rational numbers and arbitrary precision floating point numbers in real and complex form to Python. Also provides arbitrary precision floating point replacements for the functions in the math and cmath standard library modules. Home page: http://calcrpnpy.sourceforge.net/cln

Re: CRC calculation

2006-05-05 Thread Raymond L. Buvel
[EMAIL PROTECTED] wrote: > Does anyone know where I can get python code to perform a CRC > calculation on an IP packet? > Check out http://crcmod.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

[ANN] crcmod-1.3 CRC Generator

2006-04-23 Thread Raymond L. Buvel
Crcmod is a Python package for creating functions computing the Cyclic Redundancy Check (CRC). Any generating polynomial producing 8, 16, 32, or 64 bit CRCs is allowed. Generated functions can be used in Python or C/C++ source code can be generated. Home page: http://crcmod.sourceforge.net/ Chang

Re: Python C/API - *arg,**kwds variable argumnents

2005-12-14 Thread Raymond L. Buvel
[EMAIL PROTECTED] wrote: > I am writing a C extension with python 2.3.5 and need constructs > similar to python >func(*args, **kwds) > What's a neat way to do that? > I found pyrex has a __Pyx_GetStarArgs - > is there something I'm missing from the regular C/API maybe using one > of the PyArg_P

Re: binascii.crc32 results not matching

2005-12-10 Thread Raymond L. Buvel
Larry Bates wrote: Looking over the code, it seems very inefficient and hard to understand. You really should check out the following. http://sourceforge.net/projects/crcmod/ It will allow you to generate efficient CRC functions for use in Python and in C or C++. The only thing you need to in

Re: binascii.crc32 results not matching

2005-12-10 Thread Raymond L. Buvel
Tim Peters wrote: > [Raymond L. Buvel] > >>Check out the unit test in the following. >> >>http://sourceforge.net/projects/crcmod/ > > > Cool! > > >>I went to a lot of trouble to get the results to match the results of >>binascii.crc32. As y

Re: binascii.crc32 results not matching

2005-12-10 Thread Raymond L. Buvel
Peter Hansen wrote: > Larry Bates wrote: > >> I'm trying to get the results of binascii.crc32 >> to match the results of another utility that produces >> 32 bit unsigned CRCs. > > > What other utility? As Tim says, there are many CRC32s... the > background notes on this one happen to stumble

[ANN] rpncalc-2.2 RPN Calculator for Python

2005-12-03 Thread Raymond L. Buvel
The rpncalc package adds an interactive Reverse Polish Notation (RPN) interpreter to Python. This interpreter allows the use of Python as an RPN calculator. You can easily switch between the RPN interpreter and the standard Python interpreter. Home page: http://calcrpnpy.sourceforge.net/ Chang

Re: gmpy/decimal interoperation

2005-11-14 Thread Raymond L. Buvel
Alex Martelli wrote: > As things stand now (gmpy 1.01), an instance d of decimal.Decimal cannot > transparently become an instance of any of gmpy.{mpz, mpq, mpf}, nor > vice versa (the conversions are all possible, but a bit laborious, e.g. > by explicitly going through string-forms). > > I'm thin

Re: any python module to calculate sin, cos, arctan?

2005-11-08 Thread Raymond L. Buvel
Shi Mu wrote: > any python module to calculate sin, cos, arctan? The other answers in this thread point you to the standard modules. If you need arbitrary precision floating point versions of these functions check out: http://calcrpnpy.sourceforge.net/clnumManual.html -- http://mail.python.org/

Re: CRC16

2005-09-23 Thread Raymond L. Buvel
Tuvas wrote: > Anyone know a module that does CRC16 for Python? I have an aplication > that I need to run it, and am not having alot of sucess. I have a > program in C that uses a CRC16 according to CCITT standards, but need > to get a program that tests it with python as well. Thanks! > Try this

Re: 2.3 -> 2.4: long int too large to convert to int

2005-09-16 Thread Raymond L. Buvel
Grant Edwards wrote: > I give up, how do I make this not fail under 2.4? > > fcntl.ioctl(self.dev.fileno(),0xc0047a80,struct.pack("HBB",0x1c,0x00,0x00)) > > I get an OverflowError: long int too large to convert to int > > ioctl() is expecting a 32-bit integer value, and 0xc0047a80 has > the hi

Find roots of ill-conditioned polynomials

2005-09-10 Thread Raymond L. Buvel
If you are using the root finder in Numeric, and are having problems, check out the root finder in the ratfun module. My testing indicates that it will give the exact roots of a Wilkinson polynomial of degree 100. For more information see http://calcrpnpy.sourceforge.net/ratfun.html -- http://m

Re: Lossless Number Conversion

2005-08-29 Thread Raymond L. Buvel
Chris Spencer wrote: > Is there any library for Python that implements a kind of universal > number object. Something that, if you divide two integers, generates a > ratio instead of a float, or if you take the square root of a negative, > generates a complex number instead of raising an exception?

Class Library for Numbers

2005-08-20 Thread Raymond L. Buvel
I have just released a new module that interfaces the Class Library for Numbers (CLN) to Python. The CLN library is a C++ library that provides rational and arbitrary precision floating point numbers in real and complex form. The clnum module exposes these types to Python and also provides arbitr

Windows Porting Help Requested

2005-07-23 Thread Raymond L. Buvel
I am preparing to release an extension module that interfaces Python to the Class Library for Numbers (http://www.ginac.de/CLN/). This module will provide Python types for arbitrary precision floating point numbers, rational numbers, and their complex counterparts. The module also includes most o

Re: python -i (interactive environment)

2005-03-06 Thread Raymond L. Buvel
I posted the following a while back. I think this is what you are looking for. This can be done fairly easily by creating a module (lets call it interactive) with the following code in it. --- import sys,os def debug_exception(type, value, traceback): # Restore redirected standard I

Re: any Python equivalent of Math::Polynomial::Solve?

2005-02-27 Thread Raymond L. Buvel
Alex Renelt wrote: Alex Renelt wrote: in addition: I'm writing a class for polynomial manipulation. The generalization of the above code is: definitions: 1.) p = array([a_0, a_i, ..., a_n]) represents your polynomial P(x) = \sum _{i=0} ^n a_i x^i 2.) deg(p) is its degree 3.) monic(p) makes P moni

Re: any Python equivalent of Math::Polynomial::Solve?

2005-02-26 Thread Raymond L. Buvel
Just wrote: SciPy indeed appear to contain a solver, but I'm currently stuck in trying to _get_ it for my platform (OSX). I'm definitely not going to install a Fortran compiler just to evaluate it (even though my name is not "Ilias" ;-). Also, SciPy is _huge_, so maybe a Python translation of

Re: newbie question on python 2.4 and tkinter

2005-02-19 Thread Raymond L. Buvel
David Joyner wrote: Hi: I'm trying to compile python 2.4 with tkinter. (I'm trying to write a gui interface which calls a program called GAP - I'm hoping to use subprocess, a python 2.4 module, since I was getting deadlocks using popen). The instructions at the python web site said basically to edi

Re: DOS problem (simple fix??)

2005-01-08 Thread Raymond L. Buvel
Robert Brewer wrote: Gavin Bauer wrote: My DOS window (running in windows ME) closes the second it finishes running my programs. As you can imagine, this makes it hard to see the results. I've gotten in the habit of putting raw_input("Press enter to exit") at the end of every program, and in additi

[ANN] ratfun-1.0 Polynomials And Rational Functions

2005-01-02 Thread Raymond L. Buvel
The ratfun module provides classes for defining polynomial and rational function (ratio of two polynomials) objects. These objects can be used in arithmetic expressions and evaluated at a particular point. Home page: http://calcrpnpy.sourceforge.net/ratfun.html Note: If you are using rpncalc-1.

[ANN] rpncalc-1.2 RPN Calculator For Python

2005-01-02 Thread Raymond L. Buvel
The rpncalc package adds an interactive Reverse Polish Notation (RPN) interpreter to Python. This interpreter allows the use of Python as an RPN calculator. You can easily switch between the RPN interpreter and the standard Python interpreter. Home page: http://calcrpnpy.sourceforge.net/ Changes

Re: exposing C array to python namespace: NumPy and array module.

2005-01-01 Thread Raymond L. Buvel
Bo Peng wrote: Dear list, I am writing a Python extension module that needs a way to expose pieces of a big C array to python. Currently, I am using NumPy like the following: PyObject* res = PyArray_FromDimsAndData(1, int*dim, PyArray_DOUBLE, char*buf); Users will get a Numeric Array object an

[ANN] rpncalc-1.1 RPN Calculator For Python

2004-12-21 Thread Raymond L. Buvel
The rpncalc package adds an interactive Reverse Polish Notation (RPN) interpreter to Python. This interpreter allows the use of Python as an RPN calculator. You can easily switch between the RPN interpreter and the standard Python interpreter. Home page: http://calcrpnpy.sourceforge.net/ Changes

Re: A rational proposal

2004-12-19 Thread Raymond L. Buvel
Alex Martelli wrote: Raymond L. Buvel <[EMAIL PROTECTED]> wrote: Mike Meyer wrote: PEP: XXX Title: A rational number module for Python I think it is a good idea to have rationals as part of the standard distribution but why not base this on the gmpy module (https://sourceforge.net/pr

Re: A rational proposal

2004-12-18 Thread Raymond L. Buvel
Mike Meyer wrote: PEP: XXX Title: A rational number module for Python I think it is a good idea to have rationals as part of the standard distribution but why not base this on the gmpy module (https://sourceforge.net/projects/gmpy)? That module already provides good performance. However, it d