Math errors in python

A

Alex Martelli

Richard Hanson said:
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. 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;-).


Alex
 
R

Richard Hanson

Alex said:
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. ;-)
 
A

Anna Martelli Ravenscroft

Radioactive said:
Thanks to all for info here. Sorry for inadvertently creating such a
long thread.
Please don't feel you need to apologize. These guys enjoy discussing
such abstract, theoretical complexities - that's why they're so good at
what they do!

Hope that you did get your question answered along the way. If you have
more questions, please post them. You may also consider posting to the
Python Tutor mailing list <[email protected]>, where they are geared more
specifically to answering newbie questions (rather than debating the
intricacies of Pi).

Welcome and enjoy Python!

Anna
 
A

Anna Martelli Ravenscroft

Note: I posted a response yesterday, but it apparently never appeared (I
was having some trouble with my newsreader) so I'm posting this now. My
apologies if it is a duplicate.

Alex said:
Yes, but applying rational arithmetic by default might slow some
computations far too much for beginners' liking! My favourite for
Python 3.0 would be to have decimals by default, with special notations
to request floats and rationals (say '1/3r' for a rational, '1/3f' for a
float, '1/3' or '1/3d' for a decimal with some default parameters such
as number of digits). This is because my guess is that most naive users
would _expect_ decimals by default...

I agree. Naive (eg, non-CS, non-Mathemetician/Engineer) users who grew
up with calculators and standard math courses in school may have never
even heard of floats! (I made it as far as Calculus 2 in college, but
still had never heard of them.)

This brings me to another issue. Often c.l.py folks seem surprised that
people don't RTFM about floats before they ask about why their math
calculations aren't working. Most of the folks asking have no idea they
are *doing* float arithmetic, so when they try to google for the answer,
or look in the docs for the answer, and skip right past the "Float
Arithmetic" section of the FAQ and the Tutorial, it's because they're
not DOING float arithmetic - that they know of... So, of course they
won't read those sections to look for their answer, any more than they'd
read the Complex Number calculations section... People who know about
floats con't need that section - the ones who do need it, con't know
they need it.

If you want people to find those sections when they are looking for
answers to why their math calculations aren't working - I suggest you
remove the "FLOAT" from the title. Something in the FAQ like: "Why are
my math calculations giving weird or unexpected results?" would attract
a lot more of the people you WANT to read it. Once you've roped them in,
*then* you can explain to them about floats...

Anna Martelli Ravenscroft
 
R

Richard Hanson

Anna said:
If you want people to find those sections when they are looking for
answers to why their math calculations aren't working - I suggest you
remove the "FLOAT" from the title. Something in the FAQ like: "Why are
my math calculations giving weird or unexpected results?" would attract
a lot more of the people you WANT to read it. Once you've roped them in,
*then* you can explain to them about floats...

Excellent point.

(Or, "+1" as the "oldbies" say. ;-) )

Nice to "meet" you, too -- welcome! (Even if I'm primarily only a
lurker.)

(Alex mentioned you have a Fujitsu LifeBook -- I do, too, and like it
very much!)

---

[Note: I am having equipment and connectivity problems. I'll be back
as I can when I get things sorted out better, and as appropriate (or
inappropriate ;-) ). Thanks to you and to all for the civil
and fun discussions!]


Richard Hanson
 
A

Alex Martelli

Richard Hanson said:
(Alex mentioned you have a Fujitsu LifeBook -- I do, too, and like it
very much!)

There are many 'series' of such "Lifebooks" nowadays -- it's become as
un-descriptive as Sony's "Vaio" brand or IBM's "Thinkpad". Anna's is a
P-Series -- 10.5" wide-form screen, incredibly tiny, light, VERY
long-lasting batteries. It was the _only_ non-Apple computer around at
the local MacDay (I'm a Mac fan, and she attended too, to keep an eye on
me I suspect...;-), yet it got nothing but admiring "ooh!"s from the
crowd of design-obsessed Machies (Apple doesn't make any laptop smaller
than 12", sigh...).

OBCLPY: Python runs just as wonderfully on her tiny P-Series as on my
iBook, even though only Apple uses it within the OS itself;-)


Alex
 
R

Richard Hanson

[Connection working again...?]

Alex said:
There are many 'series' of such "Lifebooks" nowadays -- it's become as
un-descriptive as Sony's "Vaio" brand or IBM's "Thinkpad". Anna's is a
P-Series -- 10.5" wide-form screen, incredibly tiny, light, VERY
long-lasting batteries.

Ahem. As I said ;-) in my reply to your post mentioning Anna's P2000
(in my MID: <[email protected]>), and in
earlier postings re 2.4x installation difficulties, mine is a Fujitsu
LifeBook P1120. (Sorry, Alex! I definitely *should* have mentioned the
model again -- I'm just beginning to appreciate the difficulty of even
*partially* keeping up with c.l.py. I'm learning, though. :) )

In any event, the Fujitsu LifeBook P1120 has a 8.9" wide-format
screen, is 2.2lbs.-light with the smaller *very* long-lasting battery
and 2.5lbs.-light with the very, *very* long-lasting battery, and has
-- what tipped the scales, as it were, for my needs -- a touchscreen
and stylus.
It was the _only_ non-Apple computer around at
the local MacDay (I'm a Mac fan, and she attended too, to keep an eye on
me I suspect...;-), yet it got nothing but admiring "ooh!"s from the
crowd of design-obsessed Machies (Apple doesn't make any laptop smaller
than 12", sigh...).

I can feel your pain. I would switch to Apple in a second if they had
such light models (and if I had the bucks ;-) ). I need a very light
machine for reasons specified earlier. (Okay, slightly reluctantly:
Explicit may be better even with *this* particular info -- I have
arthritis [ankylosing spondylitis] and need very light laptops to read
and write with. :) )
OBCLPY: Python runs just as wonderfully on her tiny P-Series as on my
iBook, even though only Apple uses it within the OS itself;-)

ObC.l.pyFollow-up: Python also runs very well on my tinier ;-) P1120
with the Transmeta Crusoe TM5800 processor running at 800MHz and with
256MB RAM and a 256KB L2 on-chip cache -- even using Win2k. :) It's
really nice not needing a fan on a laptop, as well -- even when
calculating Decimal's sqrt() to thousands of decimal places. ;-)

ObExplicit-metacomment: I'm only attempting a mixture of info *and*
levity. :)


what?-men-arguing-about-whose-is-*tinier*?!'ly y'rs,
Richard Hanson
 
C

Cameron Laird

[Connection working again...?]

.
.
.
Ahem. As I said ;-) in my reply to your post mentioning Anna's P2000
(in my MID: <[email protected]>), and in
earlier postings re 2.4x installation difficulties, mine is a Fujitsu
LifeBook P1120. (Sorry, Alex! I definitely *should* have mentioned the
model again -- I'm just beginning to appreciate the difficulty of even
*partially* keeping up with c.l.py. I'm learning, though. :) )

In any event, the Fujitsu LifeBook P1120 has a 8.9" wide-format
screen, is 2.2lbs.-light with the smaller *very* long-lasting battery
and 2.5lbs.-light with the very, *very* long-lasting battery, and has
-- what tipped the scales, as it were, for my needs -- a touchscreen
and stylus. .
.
.
I can feel your pain. I would switch to Apple in a second if they had
such light models (and if I had the bucks ;-) ). I need a very light
machine for reasons specified earlier. (Okay, slightly reluctantly:
Explicit may be better even with *this* particular info -- I have
arthritis [ankylosing spondylitis] and need very light laptops to read
and write with. :) )
OBCLPY: Python runs just as wonderfully on her tiny P-Series as on my
iBook, even though only Apple uses it within the OS itself;-)

ObC.l.pyFollow-up: Python also runs very well on my tinier ;-) P1120
with the Transmeta Crusoe TM5800 processor running at 800MHz and with
256MB RAM and a 256KB L2 on-chip cache -- even using Win2k. :) It's
really nice not needing a fan on a laptop, as well -- even when
calculating Decimal's sqrt() to thousands of decimal places. ;-)
.
.
.
Is Linux practical on these boxes? How do touch-typists like them
 
R

Richard Hanson

Cameron said:
Anna Martelli Ravenscroft's Fujitsu LifeBook P2000 to my
(Richard Hanson's) Fujitsu LifeBook P1120]:
[...]

In any event, the Fujitsu LifeBook P1120 has a 8.9" wide-format
screen, is 2.2lbs.-light with the smaller *very* long-lasting battery
and 2.5lbs.-light with the very, *very* long-lasting battery, and has
-- what tipped the scales, as it were, for my needs -- a touchscreen
and stylus.

[...]

Alex said:
OBCLPY: Python runs just as wonderfully on her tiny P-Series as on my
iBook, even though only Apple uses it within the OS itself;-)

ObC.l.pyFollow-up: Python also runs very well on my tinier ;-) P1120
with the Transmeta Crusoe TM5800 processor running at 800MHz and with
256MB RAM and a 256KB L2 on-chip cache -- even using Win2k. :) It's
really nice not needing a fan on a laptop, as well -- even when
calculating Decimal's sqrt() to thousands of decimal places. ;-)
.
.
.
Is Linux practical on these boxes?

I've found on the web accounts of two people, at least, getting the
P1120 working with Linux and with at least partial functionality of
the touchscreen -- one individual claimed full functionality. (I found
some accounts of success with getting Linux working on the P2000, as
well.) I'm currently waiting to purchase a new harddrive for my P1120
to see for myself if I can get Linux installed with the touchscreen
fully functioning -- which, as I mentioned in my post, is particularly
important to me.
How do touch-typists like them

I've been touch-typing since I was about nine-years-old. When I was
looking for a very light laptop for reasons mentioned in my post, I
was concerned that I wouldn't be able to touch-type on the ~85% (16mm
pitch) keyboard. I went to a local "big box" computer store (who shall
remain nameless) and tried one of the P1120s -- within seconds I
realized I could easily adapt and subsequently ordered one from
Fujitsu.

I would estimate that I was typing *faster* and with substantially
*fewer* errors inside of several weeks -- and occasional uses of the
standard-sized keyboard on my HP Omnibook 900B made me feel like a
Munchkin. :)

Now that I'm temporarily back on the standard-pitch Omnibook 900B, I
have adapted to the what-had-come-to-seem-a-humongous keyboard, once
again. I most definitely prefer the P1120's keyboard.

I note that on the P1120, I could reach difficult key-combinations
much easier, and also, that I could often hold down two keys of a
three-key combo, say, with one finger or thumb.

Your mileage may vary, as they say, but I now prefer smaller
keyboards.

The "instant on-off" works very well, too. I highly recommend the
P1120 for anyone who isn't put off by the smaller keyboard. (Drawing
on the screen with the stylus is pretty trick, as well.)


Richard Hanson
 
A

Alex Martelli

Cameron Laird said:
Is Linux practical on these boxes?

Never got 'sleep' to work (there's supposed to be a 'hybernate' thingy,
but I haven't found it to work reliably either). AFAIMC, that's the
biggie; everything else is fine.
How do touch-typists like them

Just fine (the 10.5" P2000 -- can't speak for the even-smaller P1000s).


Alex
 
A

Anna Martelli Ravenscroft

Cameron said:
Richard Hanson said:
[Connection working again...?]

Alex Martelli wrote:

...

(Alex mentioned you have a Fujitsu LifeBook -- I do, too, and like it
very much!)
.
.
.

Ahem. As I said ;-) in my reply to your post mentioning Anna's P2000
(in my MID: <[email protected]>), and in
earlier postings re 2.4x installation difficulties, mine is a Fujitsu
LifeBook P1120. (Sorry, Alex! I definitely *should* have mentioned the
model again -- I'm just beginning to appreciate the difficulty of even
*partially* keeping up with c.l.py. I'm learning, though. :) )

In any event, the Fujitsu LifeBook P1120 has a 8.9" wide-format
screen, is 2.2lbs.-light with the smaller *very* long-lasting battery
and 2.5lbs.-light with the very, *very* long-lasting battery, and has
-- what tipped the scales, as it were, for my needs -- a touchscreen
and stylus.
.
.
.

I can feel your pain. I would switch to Apple in a second if they had
such light models (and if I had the bucks ;-) ). I need a very light
machine for reasons specified earlier. (Okay, slightly reluctantly:
Explicit may be better even with *this* particular info -- I have
arthritis [ankylosing spondylitis] and need very light laptops to read
and write with. :) )

OBCLPY: Python runs just as wonderfully on her tiny P-Series as on my
iBook, even though only Apple uses it within the OS itself;-)

ObC.l.pyFollow-up: Python also runs very well on my tinier ;-) P1120
with the Transmeta Crusoe TM5800 processor running at 800MHz and with
256MB RAM and a 256KB L2 on-chip cache -- even using Win2k. :) It's
really nice not needing a fan on a laptop, as well -- even when
calculating Decimal's sqrt() to thousands of decimal places. ;-)

.
.
.
Is Linux practical on these boxes? How do touch-typists like them

Well, mine is dual boot. I'm currently experimenting with Ubuntu on my
Linux partition... I'm really REALLY hoping for a linux kernel with a
decent 'sleep' function to come up RSN because I despise having to work
in Windoze XP instead of Linux. Ah well, at least the XP hasn't been too
terrible to work on - it runs surprisingly smoothly, particularly with
Firefox and Thunderbird for browsing and email...

And I can touch type just fine - except for the damn capslock key (there
is NO purpose whatsoever for a capslock key as a standalone key on a
modern keyboard, imho). I've had only minor problems with the touch
typing that I do - and that, only due to the slightly different layout
of the SHIFT key on the right side compared to where I'd normally expect
to find it: keyboard layout is a common bugbear on laptops though,
regardless of size....

Anna
 
R

Richard Hanson

Anna Martelli Ravenscroft wrote:

[This post primarily contains solutions to Anna's problem with the
Fujitsu LifeBook P2000's key locations. But, there's also some 2.4x
MSI Installer anecdotal info in my footnote.]
Well, mine is dual boot. I'm currently experimenting with Ubuntu on my
Linux partition... I'm really REALLY hoping for a linux kernel with a
decent 'sleep' function to come up RSN because I despise having to work
in Windoze XP instead of Linux. Ah well, at least the XP hasn't been too
terrible to work on - it runs surprisingly smoothly, particularly with
Firefox and Thunderbird for browsing and email...

My Fujitsu LifeBook P1120 is (was) only single-booting Win2k, so I
can't help with the Linux "sleep" function as yet -- I'll be working
on dual-booting Win2k and Linux on the P1120 as soon as I get the
requisite hardware to rebuild things. The "sleep" function is a *very*
high priority for me, so if and when I find a solution, I'll post it
if you're still needing such -- may well work for your P2000 as well.
And I can touch type just fine - except for the damn capslock key (there
is NO purpose whatsoever for a capslock key as a standalone key on a
modern keyboard, imho).

It seems *many* folks agree; read below.
I've had only minor problems with the touch
typing that I do - and that, only due to the slightly different layout
of the SHIFT key on the right side compared to where I'd normally expect
to find it: keyboard layout is a common bugbear on laptops though,
regardless of size....

[I lost all my recent archives in a recent series of "crashes" -- so I
regoogled this morning for the info herein.]

On Win2k, and claimed for WinXP, one can manually edit the registry to
remap any of the keys. I originally did this on my P1120 with Win2k.
Worked just fine.

(I had saved to disc before a Win98SE crash just a few minutes ago
;-), the manual regedit values. If you're interested in 'em you may
post here or contact me off-group. The email addie below works if
unmunged -- ObExplicit: replace the angle-bracketed items with the
appropriate symbol.)

Also, there are tools available from both MS, and for those who don't
like to visit MS ;-), free from many other helpful folks.

If my memory serves, I liked best the (freeware, I believe) tool
KeyTweak:

<http://webpages.charter.net/krumsick/KeyTweak_install.exe>

available from this page:

<http://webpages.charter.net/krumsick>

---

MS's tool is Remapkey.exe. (NB: I have not tried this tool --
*usually* my firewall blocks MS :) [which required an unblocking to
install 2.4ax because of the new MSI Installer[1] :) ].) This tool
may already be on one of your MS CDs in the reskit dirs (I haven't
looked in mine).

In any event, one webpage:

<http://www.annoyances.org/exec/forum/winxp/t1014389848>

describes Remapkey.exe as:

"... a nifty tool put out by microsoft (sic). Make sure you get the
correct version for your OS. Not resource intensive like other dll
apps."

The page has these links (quoted herein):

For individual downloads:
<http://www.dynawell.com/support/ResKit/winxp.asp>

Free from Microsoft site, for full downloads
<http://www.microsoft.com/downloads/...69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en>

or shorter link:
<http://www.petri.co.il/download_windows_2003_reskit_tools.htm>

---

I also have links to a few other freeware (some open-source) tools for
all versions of Win32. I won't add them now, but repost or contact me
if you want more info from my research.

---

Additionally, I found many solutions for Linux, but haven't
investigated those as (as I said) I have not yet installed Linux on my
Fujitsu LifeBook P1120. Again, if you have trouble locating a Linux
key-remapping method, let me know as I found lots of links for the
better OS :), as well.

(I do note that after several reinstalls on the P1120, that I was
finally used to the capslock and shift key locations well enough to
avoid wrongly hitting them very often. As they say, though, your
mileage may vary.)


Richard Hanson
___________________________________________
[1] On this HP Omnibook 900B even after downloading the requisite MSI
Install file, I experienced multiple errors trying to install 2.4a3.2
on Win98SE. I finally got 2.4x working, but I note that the helpfiles
are still missing the navigation icons. I have the MSI Installer error
messages if Martin or anyone is interested.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top