Math errors in python

Richard Hanson me at privacy.net
Thu Sep 23 13:17:54 EDT 2004


Alex Martelli wrote:

> Richard Hanson <me at privacy.net> wrote:
> 
> > Peter Otten wrote:
> >  
> > > The auther is currently working on an installer, but just dropping it into
> > > 2.3's site-packages should work, too.
> > 
> > I just dropped decimal.py from 2.4's Lib dir into 2.3.4's Lib dir.
> > Seems to work. Any gotchas with this route?
> 
> None that I know of.  

Good to hear. My interest (besides my Pathfinder project which I
introduced in another [OT] thread :-) ), also is in developing
continuing improvements to my COGO software (despite my being retired
for many years and having no personal need for such). 

(Now that I note the substantial speedup in CVS of Decimal's sqrt(), I
am getting interested once again in getting back to my COGO-in-Python
project [when I get a chance :-) ], and see just what success I have
working up a relatively fast arctangent function.[1] Besides an
arctangent function, a COGO-using-Decimal also needs to have pi
available to an arbitrary number of decimal places. My sketches
heretofore used precalculated values of pi to a ridiculous number of
decimal places in string form, from which a simple slice would give
the requisite value as the current Context may require. [Decimal's
help files include snippets for some simpler versions of sine and
cosine, and thus, tangent. If I get the chance -- and the ability to
comprehend the state-of-the-art as referenced in my footnote -- to
implement a fast arctangent function in Decimal, similarly implemented
algorithms should also speed up sine and cosine.][2])

> Indeed, the author originally wanted to have that
> approach as the one and only way to use decimal with 2.3, I just made
> myself a nuisance to him insisting that many inexperienced Pythonistas
> would have been frigthened to even try that, so finally he packaged
> things up when he realized it would take less of his time than putting
> up with yet another whining email from me;-).

Heh. I, for one, have greatly enjoyed reading your posts over the
years. I think that you are correct in that *non*-computer folks --
arguably part of a target audience for Python -- can be easily
frightened by the complexity of the abstractions common in compsci. It
is part of Guido's genius that he recognizes such; he has aimed to
keep Python accessible to non-programmer-types (Donald Knuth estimated
that only about one-percent of humans even have the proper brain
organization to be potential programmers, but I digest. :-) ) even as
fancier, but quite powerful, complexity-controlling enhancements such
as generators are added to the language.

In any event, thanks for the comments! Keep up the good work and the
posting!


enjoying-reading-the-postings-'ly y'rs,
Richard Hanson
_____________________________________
[1] I've skimmed R. P. Brent's work, but haven't yet found the time to
understand all of it well enough to develop the requisite trig
functions in Python's Decimal.

[2] Traditionally, the precision of generic eight-byte floating point
types has been sufficient for COGO. However, now, with the advancement
in cheap-but-powerful computing power, and with the prevalence of GPS,
such things as the Kalman Filter and other iterative matrix algorithms
now require BIGNUM decimal places to avoid degenerate solutions near
singularities and such.[3]

[3] I caution that I am an autodidact, and may sound more educated
than I actually am. ;-)

-- 
sick<PERI0D>old<P0INT>fart<PIE-DEC0-SYMB0L>newsguy<MARK>com



More information about the Python-list mailing list