ラベル python の投稿を表示しています。 すべての投稿を表示
ラベル python の投稿を表示しています。 すべての投稿を表示

2006年11月6日月曜日

random.randrange

I encountered a question why can't we use random.randrange
instead of nzmath.bigrange.

I guess the original intension was to be used with Python
2.2, since that version has the function with limited range.
It means that the big integer argument caused OverflowError
or something.

Today, I test random.randrange. It looks good enough at the
first grance. But, it isn't usable for big integers. The
returned values are rarely in the specified (virtual) range.

I filed a bug for Python:
http://sourceforge.net/tracker/?func=detail&aid=1590891&group_id=5470&atid=105470

2006年10月24日火曜日

computation of dmath.log(13)

I found a strange behavior of dmath.log.
If I set the precision to 12 (decimal.getcontext().prec=12),
dmath.log(13) returns Decimal("2.56494935746").
But, if I set the precision to 20, dmath.log(13) never halts.

Is it a bug of dmath.log, or of decimal module of Python?

2006年9月27日水曜日

dmath

Oh, I was thinking to write a module like this, a few days
ago. But, you know, NZMATH is kept to be able to run on
Python 2.3 and decimal is new to 2.4, so I was hesitating to
take an action.

dmath

It's available under MIT license. Great.

2005年4月20日水曜日

pylint

pylint を入れてみた。 NZMATH のコードに対して走らせると、変数の名前が短すぎる、というのがたくさん出る。 自然数 n とか有理数 r なんてものをどう伸ばせと? あと、lambda の変数は「初期化せずに使っている」とエラーにされた。

2005年3月22日火曜日

SAGE

SAGE といっても SAGE とは関係ない。 SAGE (Software for Arithmetic & Geometry Experimentation) というのが最近出きたという話。 Python から PARI を呼ぶことで計算システム化するようだ。

ちなみに、PariPython というプロジェクトが昔あったが、1996年ぐらいに終了していたらしい。