Re: Significant digits in a float?
On 2014-05-02, Dennis Lee Bieber wrote: On Thu, 01 May 2014 21:55:20 +0100, Adam Funk a24...@ducksburg.com declaimed the following: On 2014-05-01, Dennis Lee Bieber wrote: Math teacher was selling them in my 10th grade... Actually I already owned a Faber-Castell 57/22 Business ruler (which did NOT have the CF/DF scales set for *PI) and a Pickett N-1010-ES Trig rule. What does a business slide-rule do? Depreciation? Special markers for: dozen, gross; a scale for non-metric measures to metric equivalents -- US Bushel, UK (brit) bushel, US gallon, UK gallon, short and long tons, a few Russian units, Pud and R.t. which appear to map to cubic inch and cubic foot; markings for % (discount and mark-up) And a scheme for simple interest calculations (which may explain why the CF/DF scales are longer than the C/D scales): Move the main cursor line over the principal on scale DF -- the principal must be taken only on scale DF -- set the rate per cent on the scale CI, under the short cursor line, and read the interest on the scale DF or D in line with the number of days on the scale CF or C. {yes, just to the left of the normal cursor is a short line only over the inverted C scale} Interesting, thanks. -- I used to be better at logic problems, before I just dumped them all into TeX and let Knuth pick out the survivors. -- plorkwort -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 5/1/14 9:06 PM, Dennis Lee Bieber wrote: The N4-ES and the N4-T (mine) are essentially the same rule. The N4-ES on the site is yellow (mine is white) and the site rule indicates Picket Eckel Inc. (that's where the E comes from) Also the the ES states Chicage Ill USA where the T states Made in USA. ES was for Eye-Saver -- the yellow background vs the bright white of the other models. Actually, I think you're right. I never used the a yellow rule, but I will say that my N4-T never caused me any eye-strain (but I was younger then). The N4-T was a flat white also... very easy to read. I really don't know what all the 'yellow' hype was all about. -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 5/1/14 8:47 PM, Dennis Lee Bieber wrote: On Wed, 30 Apr 2014 22:54:21 -0500, Mark H Harris harrismh...@gmail.com declaimed the following: My high school '74 was the last class to learn the slide-rule using the Sterling (we paid a deposit to use the school's). Since calculators had started to appear, I never did get formal training in slide-rules. The LL scales still require me to glance at a guide book... I regret that I never risked the $35 dollars when my college bookstore was closing out the slide-rule display. They had the top Post bamboo laminate rule at half price. At the time I'd bought an HP-25 calculator [they phased out the HP brand a year or two later -- apparently RPN was too confusing]. Half way through my senior year the HP-65 gold key calculator was available for about $800.00 dollars. That sucker was programmable and had magnetic strip recorder for off-loading storage... but I digress. We all had our priorities... one guy bought one; the rest of us bought cars. ---for about the same price too! I used my rule well into college; the first calculator I owned was the Rockwell 63R --- The Big green numbers, and the little rubber feet! marcus -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Tue, 06 May 2014 09:51:25 -0500, Mark H Harris wrote: On 5/1/14 9:06 PM, Dennis Lee Bieber wrote: The N4-ES and the N4-T (mine) are essentially the same rule. The N4-ES on the site is yellow (mine is white) and the site rule indicates Picket Eckel Inc. (that's where the E comes from) Also the the ES states Chicage Ill USA where the T states Made in USA. ES was for Eye-Saver -- the yellow background vs the bright white of the other models. Actually, I think you're right. I never used the a yellow rule, but I will say that my N4-T never caused me any eye-strain (but I was younger then). The N4-T was a flat white also... very easy to read. I really don't know what all the 'yellow' hype was all about. probably about $XX.XX more :-) (before my time so I would not have a clue about the actual cost) -- If you don't do the things that are not worth doing, who will? -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
HP 35. $350 in 1973 or 4. Still have it somewhere. Tom yay! On May 6, 2014 11:20 AM, alister alister.nospam.w...@ntlworld.com wrote: On Tue, 06 May 2014 09:51:25 -0500, Mark H Harris wrote: On 5/1/14 9:06 PM, Dennis Lee Bieber wrote: The N4-ES and the N4-T (mine) are essentially the same rule. The N4-ES on the site is yellow (mine is white) and the site rule indicates Picket Eckel Inc. (that's where the E comes from) Also the the ES states Chicage Ill USA where the T states Made in USA. ES was for Eye-Saver -- the yellow background vs the bright white of the other models. Actually, I think you're right. I never used the a yellow rule, but I will say that my N4-T never caused me any eye-strain (but I was younger then). The N4-T was a flat white also... very easy to read. I really don't know what all the 'yellow' hype was all about. probably about $XX.XX more :-) (before my time so I would not have a clue about the actual cost) -- If you don't do the things that are not worth doing, who will? -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
[OT] Silde rules [was Re: Significant digits in a float?]
On Tue, 06 May 2014 09:59:22 -0500, Mark H Harris wrote: [...] I used my rule well into college; the first calculator I owned was the Rockwell 63R --- The Big green numbers, and the little rubber feet! Guys, heaven knows I'm guilty of the occasional off-topic post myself, and I'm not obsessive about these things, but there comes a time in every off-topic thread where the right thing to do is to label it off-topic. And this thread has long passed that time! -- Steven D'Aprano http://import-that.dreamwidth.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 5/1/14 10:53 AM, William Ray Wing wrote: I’m surprised no one has jumped in to defend/tout the Dietzgen slide rules (which I always thought were the ultimate). Mine (their Vector Log Log) is one of their Microglide series that had teflon rails inserted in the body and is still totally stick-free after nearly 50 years. http://www.marksmath.com/slide-rules/img/ed-n1725.jpg The above link is nice for the Dietzgen Microglide. It doesn't have the CF/m DF/m scales, but is a very nice Vector type log log. Most of my drafting equipment from the same era was Dietzgen; it looked like the previous video post featured the same/ My dad has one of these; but I can't get him to part with it yet... marcus -- https://mail.python.org/mailman/listinfo/python-list
Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]
Terry Reedy wrote: For the most part, there are no bears within a mile of the North Pole either. they are rare north of 88° (ie, 140 miles from pole). https://en.wikipedia.org/wiki/Polar_bears They mostly hunt in or near open water, near the coastlines. The way things are going, the coastline might be within a mile of the north pole quite soon. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]
2014-05-01 3:57 GMT+02:00 Chris Angelico ros...@gmail.com: On Thu, May 1, 2014 at 9:46 AM, Ian Kelly ian.g.ke...@gmail.com wrote: It also works if your starting point is (precisely) the north pole. I believe that's the canonical answer to the riddle, since there are no bears in Antarctica. Yeah but that's way too obvious! Anyway, it's rather hard to navigate due south from the north pole. Which way do you go? How do you know you're still going due south? Will the rocket even light in that climate? Important questions must be answered! ChrisA -- https://mail.python.org/mailman/listinfo/python-list Well, after having been following the discussion, I couldn't resist but post the relevant sketch from the famous Czech play The Conquest of the North Pole by the Czech Karel Němec on 5th April 1909 by Jara Cimrman [as dicovered and presented by Z. Sverak and L. Smoljak] (translated by Craig Cravens) http://jaracimrman.files.wordpress.com/2010/04/north_pole.pdf (pp. 38-39) Teacher: And now, friends, I’d like to draw your attention to a certain geographical peculiarity. If I stand next to the chief and step off in any direction, I always go south. Pharmacist: No! Teacher: Yes, yes! Watch! (stands next to the chief and steps off.) I’m going south. (He returns and sets off in another direction.) And now I’m going south again. And now —once again south. Pharmacist: That’s unbelievable! Teacher: Hold on, you haven’t seen anything yet. Richard, stand here with your back to the chief. And now both of you, step forward. (Schwarzenegger and the chief, with their backs to each other, step forward.) Did you see that? They’re both going south! Pharmacist: That’s really something else! Teacher: And I’ve saved the best for last. Now, you’ll really see something. Vojtěch, mark the Pole with an X and step aside. (Vojtěch obeys. The teacher sets off toward the mark.) Watch this. I’m going north (he crosses the mark and continues walking) and now I’m going south! And now back: north … and now south. Pharmacist: That’s impossible! Teacher: Try it yourself. Pharmacist: This I’ve got to see. (He walks towards the pole and them moment he crosses it his face lights up with joy.) Wow! Friends, this was worth it! On the verge of death from hypothermia, from hunger, and from exhaustion, but it was worth it! = regards, vbr -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
In article ljsghc$65b$1...@speranza.aioe.org, Mark H Harris harrismh...@gmail.com wrote: Absolutely, snort. I still have my KE (Keuffel Esser Co. N.Y.); made of wood... (when ships were wood, and men were steel, and sheep ran scared) ... to get to the S L T scales I have to pull the slide out (turn it over) and reinsert it. You're right, the CF and DF scales are missing, but the A B scales have the Ï symbol where it should be (more or less). Mine is the 4058 C model, and you're right... has maths equivalents and conversions printed on the back... For those who have no idea what we're talking about, take a look at http://www.ted.com/talks/clifford_stoll_on_everything. If you just want to see what you do with a slide rule, fast forward to 14:20, but you really owe it to yourself to invest the 18 minutes to watch the whole thing. -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 04/30/2014 11:21 AM, Grant Edwards wrote: On 2014-04-29, emile em...@fenx.com wrote: On 04/29/2014 01:16 PM, Adam Funk wrote: A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) From how many locations on Earth can someone walk one mile south, one mile east, and one mile north and end up at their starting point? I'm pretty sure there are places in London like that. At least that's what it seemed like to somebody from the midwestern US where the streets are layed out on a grid. I was going to bring up London, but as I recall from my brief visit there, I wasn't sure you could go one mile straight in any direction. :) Emile -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Thu, 01 May 2014 09:34:35 -0700, emile wrote: On 04/30/2014 11:21 AM, Grant Edwards wrote: On 2014-04-29, emile em...@fenx.com wrote: On 04/29/2014 01:16 PM, Adam Funk wrote: A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) From how many locations on Earth can someone walk one mile south, one mile east, and one mile north and end up at their starting point? I'm pretty sure there are places in London like that. At least that's what it seemed like to somebody from the midwestern US where the streets are layed out on a grid. I was going to bring up London, but as I recall from my brief visit there, I wasn't sure you could go one mile straight in any direction. :) Emile 100 yds is pushing it -- They told me I was gullible ... and I believed them! -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On May 1, 2014, at 12:16 AM, Mark H Harris harrismh...@gmail.com wrote: On 4/30/14 10:56 PM, Paul Rubin wrote: There is a nice Javascript simulation of the N4-ES here: http://www.antiquark.com/sliderule/sim/n4es/virtual-n4es.html Thank you! The N4-ES and the N4-T (mine) are essentially the same rule. The N4-ES on the site is yellow (mine is white) and the site rule indicates Picket Eckel Inc. (that's where the E comes from) Also the the ES states Chicage Ill USA where the T states Made in USA. I’ve resisted - but finally have to jump into this discussion... Picket used to talk a lot about their yellow background being optimized for the color the human eye was most sensitive to and therefore produced the sharpest focus and allowed the most precise reading of the scales. Nice theory, but at least on MY Picket rule the scales were printed not engraved and the result negated any possible advantage the color might have given. I’m surprised no one has jumped in to defend/tout the Dietzgen slide rules (which I always thought were the ultimate). Mine (their Vector Log Log) is one of their Microglide series that had teflon rails inserted in the body and is still totally stick-free after nearly 50 years. Taking it one step further, I _ALSO_ have a Curta Type II calculator http://en.wikipedia.org/wiki/Curta_calculator - which still operates as smoothly as it did the day I bought it. -Bill The only technical difference is the T scale (which is folded-expanded on both). On the ES the T scale is listed only once in the margin. On the N4-T the T scale is listed 'twice'!-- once for each part of the fold. Well, that gives (2) scales instead of one --for T... increasing the number of scales on the rule from 34 to 35... if I'm counting right. Which makes the N4-T more valuable... supposedly. I don't plan are parting with it... till I croak, then my son (who is studying engineering this fall) will inherit it... heh he won't have a clue what to do with it ! The simulated rule on the site above is fabulous... especially if viewed from a large wide LED. ... simply fabulouso/:) marcus -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 05/01/2014 05:56 AM, Roy Smith wrote: In article ljsghc$65b$1...@speranza.aioe.org, Mark H Harris harrismh...@gmail.com wrote: Absolutely, snort. I still have my KE (Keuffel Esser Co. N.Y.); made of wood... (when ships were wood, and men were steel, and sheep ran scared) ... to get to the S L T scales I have to pull the slide out (turn it over) and reinsert it. You're right, the CF and DF scales are missing, but the A B scales have the π symbol where it should be (more or less). Mine is the 4058 C model, and you're right... has maths equivalents and conversions printed on the back... For those who have no idea what we're talking about, take a look at http://www.ted.com/talks/clifford_stoll_on_everything. If you just want to see what you do with a slide rule, fast forward to 14:20, but you really owe it to yourself to invest the 18 minutes to watch the whole thing. Anyone (besides me) ever seen a cylindrical slide rule? I have one -- unfortunately misplaced at the moment. :-( The scales were helical around a cylinder giving (it was claimed) to be the equivalent of a five-foot rule. But that still only gave one additional significant digit. Only two scales, however, which limited its use to multiply/divide and logs. But interesting. I just did a quick google search and found a picture of one on e-bay, asking price of $175. This price rather surprised me because when I bought mine new (probably 45 or so years ago) I'm sure I didn't pay more than around $25-$30 for it. And mine is in far better condition than the one in the e-bay photo. I recently ran across mine, but promptly misplaced it again (long story -- don't ask...). I'll have to look for it again. (And no, mine is not for sale when/if I find it again.) -=- Larry -=- -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 2014-05-01, Dennis Lee Bieber wrote: On Tue, 29 Apr 2014 20:42:33 -0400, Roy Smith r...@panix.com declaimed the following: In article mailman.9594.1398818045.18130.python-l...@python.org, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: (one reason slide-rules were acceptable for so long -- and even my high school trig course only required slide-rule significance even though half the class had scientific calculators [costing $100, when a Sterling slide-rule could still be had for $10]) G Sterling? Snort. KE was the way to go. Math teacher was selling them in my 10th grade... Actually I already owned a Faber-Castell 57/22 Business ruler (which did NOT have the CF/DF scales set for *PI) and a Pickett N-1010-ES Trig rule. What does a business slide-rule do? Depreciation? -- Mrs CJ and I avoid clichés like the plague. -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 2014-05-01, Larry Hudson wrote: On 05/01/2014 05:56 AM, Roy Smith wrote: For those who have no idea what we're talking about, take a look at http://www.ted.com/talks/clifford_stoll_on_everything. If you just want to see what you do with a slide rule, fast forward to 14:20, but you really owe it to yourself to invest the 18 minutes to watch the whole thing. Anyone (besides me) ever seen a cylindrical slide rule? I have one -- unfortunately misplaced at the moment. :-( The scales were helical around a cylinder giving (it was claimed) to be the equivalent of a five-foot rule. But that still only gave one additional significant digit. Only two scales, however, which limited its use to multiply/divide and logs. But interesting. I have a circular (really spiral) slide rule that I inherited from my grandfather. http://www.ducksburg.com/atlas_slide_rule/ One of my uncles told me that he took it (or a similar model) to university (ca. 1960, I guess) got an F on a calculus test because his answers were too accurate precise to be honest. He went to the professor's office, showed him the circular slide rule, got an A. -- To live without killing is a thought which could electrify the world, if men were only capable of staying awake long enough to let the idea soak in. --- Henry Miller -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
Chris Angelico wrote: Any point where the mile east takes you an exact number of times around the globe. So, anywhere exactly one mile north of that, which is a number of circles not far from the south pole. True, but there are no bears in Antarctica, so that rules out all the south-pole solutions. I think there are still multiple solutions, though. The bear may have been spray-painted by activists trying to protect it from polar trophy hunters. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Wed, Apr 30, 2014 at 6:14 PM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Chris Angelico wrote: Any point where the mile east takes you an exact number of times around the globe. So, anywhere exactly one mile north of that, which is a number of circles not far from the south pole. True, but there are no bears in Antarctica, so that rules out all the south-pole solutions. I think there are still multiple solutions, though. The bear may have been spray-painted by activists trying to protect it from polar trophy hunters. Well, I did suggest it might have been a black bear: http://img2.wikia.nocookie.net/__cb20130411125035/disney/images/8/88/Brave-brave-31312503-800-486.png But spray paint would work too... ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Tue, 29 Apr 2014 15:42:25 -0700, emile wrote: On 04/29/2014 01:16 PM, Adam Funk wrote: A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) From how many locations on Earth can someone walk one mile south, one mile east, and one mile north and end up at their starting point? Emile there are an infinite number of locations where this can happen (although only one where you will find a bear.) -- Gomme's Laws: (1) A backscratcher will always find new itches. (2) Time accelerates. (3) The weather at home improves as soon as you go away. -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
In article mailman.9603.1398833574.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: But I think a better answer is New York City. You start out lost, you go a mile south, a mile east, a mile north, and you are again lost. Only in Queens. -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 30/04/2014 09:14, Gregory Ewing wrote: Chris Angelico wrote: Any point where the mile east takes you an exact number of times around the globe. So, anywhere exactly one mile north of that, which is a number of circles not far from the south pole. True, but there are no bears in Antarctica, so that rules out all the south-pole solutions. I think there are still multiple solutions, though. The bear may have been spray-painted by activists trying to protect it from polar trophy hunters. Couldn't this kill the bear? My source is the book and film Goldfinger. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]
On 04/29/2014 03:51 PM, Chris Angelico wrote: On Wed, Apr 30, 2014 at 8:42 AM, emile em...@fenx.com wrote: On 04/29/2014 01:16 PM, Adam Funk wrote: A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) From how many locations on Earth can someone walk one mile south, one mile east, and one mile north and end up at their starting point? Any point where the mile east takes you an exact number of times around the globe. So, anywhere exactly one mile north of that, which is a number of circles not far from the south pole. It is my contention, completely unbacked by actual research, that if you find such a spot (heading a mile east takes you an integral number of times around the pole), that there is not enough Earth left to walk a mile north so that you could then turn-around a walk a mile south to get back to such a location. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]
On 04/30/2014 06:14 AM, Ethan Furman wrote: On 04/29/2014 03:51 PM, Chris Angelico wrote: On Wed, Apr 30, 2014 at 8:42 AM, emile em...@fenx.com wrote: On 04/29/2014 01:16 PM, Adam Funk wrote: A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) From how many locations on Earth can someone walk one mile south, one mile east, and one mile north and end up at their starting point? Any point where the mile east takes you an exact number of times around the globe. So, anywhere exactly one mile north of that, which is a number of circles not far from the south pole. It is my contention, completely unbacked by actual research, that if you find such a spot (heading a mile east takes you an integral number of times around the pole), that there is not enough Earth left to walk a mile north so that you could then turn-around a walk a mile south to get back to such a location. Wow. It's amazing how writing something down, wrongly (I originally had north and south reversed), correcting it, letting some time pass (enough to post the message so one can be properly embarrassed ;), and then rereading it later can make something so much clearer! Or maybe it was the morning caffeine. Hmmm. At any rate, I withdraw my contention, it is clear to me now (at least until the caffeine wears off). -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]
On Wed, Apr 30, 2014 at 11:14 PM, Ethan Furman et...@stoneleaf.us wrote: Any point where the mile east takes you an exact number of times around the globe. So, anywhere exactly one mile north of that, which is a number of circles not far from the south pole. It is my contention, completely unbacked by actual research, that if you find such a spot (heading a mile east takes you an integral number of times around the pole), that there is not enough Earth left to walk a mile north so that you could then turn-around a walk a mile south to get back to such a location. The circle where the distance is exactly one mile will be fairly near the south pole. There should be plenty of planet a mile to the north of that. If the earth were a perfect sphere, the place we're looking for is the place where cutting across the sphere is 1/π miles. The radius of the earth is approximately 4000 miles (give or take). So we're looking for the place where the chord across a radius 4000 circle is 1/π; that means the triangle formed by a radius of the earth and half of 1/π and an unknown side (the distance from the centre of the earth to the point where the chord meets it - a smidge less than 4000, but the exact distance is immaterial) is a right triangle. Trig functions to the rescue! We want latitude 90°-(asin 1/8000π). It's practically at the south pole: 89.9977° south (89°59'52). Are my calculations correct? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 2014-04-29, Roy Smith r...@panix.com wrote: What reason do you have to think that something recorded to 14 decimal places was only intended to have been recorded to 4? Because I understand the physical measurement these numbers represent. Sometimes, Steve, you have to assume that when somebody asks a question, they actually have asked the question then intended to ask. Sometimes. But the smart money bets against it -- especially when people are asking about floating point. :) It doesn't sound to me like you have enough information to reliably do what you want to do, but parsing the string representation is probably the best way to go. -- Grant Edwards grant.b.edwardsYow! HELLO KITTY gang at terrorizes town, family gmail.comSTICKERED to death! -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 2014-04-29, Roy Smith r...@panix.com wrote: In article mailman.9575.1398789020.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Tue, Apr 29, 2014 at 11:38 PM, Roy Smith r...@panix.com wrote: I'm trying to intuit, from the values I've been given, which coordinates are likely to be accurate to within a few miles. I'm willing to accept a few false negatives. If the number is float(38), I'm willing to accept that it might actually be float(38.), and I might be throwing out a good data point that I don't need to. You have one chance in ten, repeatably, of losing a digit. That is, roughly 10% of your four-decimal figures will appear to be three-decimal, and 1% of them will appear to be two-decimal, and so on. Is that a few false negatives? You're looking at it the wrong way. It's not that the glass is 10% empty, it's that it's 90% full, and 90% is a lot of good data :-) If you know _which_ is the good data and which is the bad... -- Grant Edwards grant.b.edwardsYow! I'm sitting on my at SPEED QUEEN ... To me, gmail.comit's ENJOYABLE ... I'm WARM ... I'm VIBRATORY ... -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 2014-04-29, emile em...@fenx.com wrote: On 04/29/2014 01:16 PM, Adam Funk wrote: A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) From how many locations on Earth can someone walk one mile south, one mile east, and one mile north and end up at their starting point? I'm pretty sure there are places in London like that. At least that's what it seemed like to somebody from the midwestern US where the streets are layed out on a grid. -- Grant Edwards grant.b.edwardsYow! It's a hole all the at way to downtown Burbank! gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]
On Thu, May 1, 2014 at 12:02 AM, Ethan Furman et...@stoneleaf.us wrote: Wow. It's amazing how writing something down, wrongly (I originally had north and south reversed), correcting it, letting some time pass (enough to post the message so one can be properly embarrassed ;), and then rereading it later can make something so much clearer! Or maybe it was the morning caffeine. Hmmm. At any rate, I withdraw my contention, it is clear to me now (at least until the caffeine wears off). It's also amazing how much fun it can be to dig into the actual mathematics, as a means of dispelling a perceived error :) So, thank you for posting that, because it forced me to actually map things out (in my head - didn't feel like using pen-and-paper geometry, even though this is the most literal form of geo-metry possible) and figure out exactly how many degrees of latitude it takes. Good fun! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]
On Wed, Apr 30, 2014 at 9:02 AM, Ethan Furman et...@stoneleaf.us wrote: On 04/30/2014 06:14 AM, Ethan Furman wrote: On 04/29/2014 03:51 PM, Chris Angelico wrote: On Wed, Apr 30, 2014 at 8:42 AM, emile em...@fenx.com wrote: On 04/29/2014 01:16 PM, Adam Funk wrote: A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) From how many locations on Earth can someone walk one mile south, one mile east, and one mile north and end up at their starting point? Any point where the mile east takes you an exact number of times around the globe. So, anywhere exactly one mile north of that, which is a number of circles not far from the south pole. It is my contention, completely unbacked by actual research, that if you find such a spot (heading a mile east takes you an integral number of times around the pole), that there is not enough Earth left to walk a mile north so that you could then turn-around a walk a mile south to get back to such a location. Wow. It's amazing how writing something down, wrongly (I originally had north and south reversed), correcting it, letting some time pass (enough to post the message so one can be properly embarrassed ;), and then rereading it later can make something so much clearer! Or maybe it was the morning caffeine. Hmmm. At any rate, I withdraw my contention, it is clear to me now (at least until the caffeine wears off). Sure, but that still leaves the nagging problem that there aren't any Polar Bears in Antarctica (as someone else pointed out). This man must have brought a bear with him. Perhaps the story is something like this: A man near the south pole takes his dear friend and pet bear for a walk. He'd gone to great lengths to bring his pet bear with him to his Antarctic expedition, and his bear is his best friend, and sole companion, save for the constant, biting cold. They walk toward the pole, then begin their excursion eastward, encircling the pole. As the man grows weary, and decides to head back, a legion of penguins collaborate with a host of Weddell seals to be rid of their uninvited guests. It isn't clear what the man did to cause those seals to rise against him, but it must have been some dire feat, for Weddell seals are not easily frightened. After a fierce battle, the man and his bear (well, mostly the bear) manage to defend themselves against the attacking throng. However, the new peace realizes a terrible fate: his bear is mortally wounded, and is suffering immensely. The man, loving his friend dearly, shoots his solitary compatriot, and weeps as he watches the blood turn his dear bear's fur an ominous red. Overcome with grief, he heads back north to his tent to mourn his loss, and to arrange his trip north to the populated tropics, where he hopes to forget his troubles, and the place where he lost his closet pal, a bear. -- https://mail.python.org/mailman/listinfo/python-list
Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]
On Wed, Apr 30, 2014 at 7:14 AM, Ethan Furman et...@stoneleaf.us wrote: On 04/29/2014 03:51 PM, Chris Angelico wrote: On Wed, Apr 30, 2014 at 8:42 AM, emile em...@fenx.com wrote: On 04/29/2014 01:16 PM, Adam Funk wrote: A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) From how many locations on Earth can someone walk one mile south, one mile east, and one mile north and end up at their starting point? Any point where the mile east takes you an exact number of times around the globe. So, anywhere exactly one mile north of that, which is a number of circles not far from the south pole. It also works if your starting point is (precisely) the north pole. I believe that's the canonical answer to the riddle, since there are no bears in Antarctica. -- https://mail.python.org/mailman/listinfo/python-list
Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]
On 4/30/2014 7:46 PM, Ian Kelly wrote: It also works if your starting point is (precisely) the north pole. I believe that's the canonical answer to the riddle, since there are no bears in Antarctica. For the most part, there are no bears within a mile of the North Pole either. they are rare north of 88° (ie, 140 miles from pole). https://en.wikipedia.org/wiki/Polar_bears They mostly hunt in or near open water, near the coastlines. I find it amusing that someone noticed and posted an alternate, non-canonical solution. How might a bear be near the south pole? As long as we are being creative, suppose some jokester mounts a near life-size stuffed black bear, made of cold-tolerant artificial materials, near but not at the South Pole. The intent is to give fright to naive newcomers. Someone walking in a radius 1/2pi circle about the pole might easily see it. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]
On Thu, May 1, 2014 at 9:46 AM, Ian Kelly ian.g.ke...@gmail.com wrote: It also works if your starting point is (precisely) the north pole. I believe that's the canonical answer to the riddle, since there are no bears in Antarctica. Yeah but that's way too obvious! Anyway, it's rather hard to navigate due south from the north pole. Which way do you go? How do you know you're still going due south? Will the rocket even light in that climate? Important questions must be answered! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 4/30/14 7:02 PM, Dennis Lee Bieber wrote: Sterling? Snort. KE was the way to go. Absolutely, snort. I still have my KE (Keuffel Esser Co. N.Y.); made of wood... (when ships were wood, and men were steel, and sheep ran scared) ... to get to the S L T scales I have to pull the slide out (turn it over) and reinsert it. You're right, the CF and DF scales are missing, but the A B scales have the π symbol where it should be (more or less). Mine is the 4058 C model, and you're right... has maths equivalents and conversions printed on the back... I've misplaced the Sterling, but I'm fairly sure it was a deci-trig log-log model. My high school '74 was the last class to learn the slide-rule using the Sterling (we paid a deposit to use the school's). I returned my Sterling to the teacher at year-end and got my deposit back. They are all probably in an old card-board box in the basement. I should ask. In the last 15-20 years I've added NIB versions of Faber-Castell 1/54 Darmstadt, Pickett N-803-ES Dual-Base Log-Log, Pickett Cleveland Institute of Electronics N-515-T, and a pair of SamaEtani/Concise circular pocket rules (models 200 and 600). I received my Pickett Model N4-T Vector-Type Log Log Dual-Base Speed Rule as a graduation | birthday gift... off to college with a leather cased slip stick hanging from my belt (I was invincable). Mine had the CF/m DF/m scales also -- folded at 2.3, the loge of 10 with π where it should be (more or less). Copyright 1959... that baby was the king of slide rules... I pull it out from time to time, just for warm feelings. Heh... I wonder if the VEs would have noticed the CIE rule had lots of electronics formulas on the back, if I'd taken it to the exam session where I passed both General and Amateur Extra tests. I couldn't take a calculator -- all of mine were programmable. But the slide-rule I took was just about as perplexing to the VEs. I carried my slide rule to my general class exam as well. The VE inspected it to be sure that certain stuff was not written in pencil between the scales! True story. Its not required today, of course, but I can still send/receive at 20 wpm. sigh marcus W0MHH '73 -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
Mark H Harris harrismh...@gmail.com writes: I received my Pickett Model N4-T Vector-Type Log Log Dual-Base Speed Rule as a graduation | birthday gift... There is a nice Javascript simulation of the N4-ES here: http://www.antiquark.com/sliderule/sim/n4es/virtual-n4es.html Some other models are also on that site. -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 4/30/14 10:56 PM, Paul Rubin wrote: There is a nice Javascript simulation of the N4-ES here: http://www.antiquark.com/sliderule/sim/n4es/virtual-n4es.html Thank you! The N4-ES and the N4-T (mine) are essentially the same rule. The N4-ES on the site is yellow (mine is white) and the site rule indicates Picket Eckel Inc. (that's where the E comes from) Also the the ES states Chicage Ill USA where the T states Made in USA. The only technical difference is the T scale (which is folded-expanded on both). On the ES the T scale is listed only once in the margin. On the N4-T the T scale is listed 'twice'!-- once for each part of the fold. Well, that gives (2) scales instead of one --for T... increasing the number of scales on the rule from 34 to 35... if I'm counting right. Which makes the N4-T more valuable... supposedly. I don't plan are parting with it... till I croak, then my son (who is studying engineering this fall) will inherit it... heh he won't have a clue what to do with it ! The simulated rule on the site above is fabulous... especially if viewed from a large wide LED. ... simply fabulouso/:) marcus -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
In article 535f0f9f$0$29965$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 28 Apr 2014 12:00:23 -0400, Roy Smith wrote: [...] Fundamentally, these numbers have between 0 and 4 decimal digits of precision, I'm surprised that you have a source of data with variable precision, especially one that varies by a factor of TEN THOUSAND. OK, you're surprised. I don't know what justification you have for combining such a mix of data sources. Because that's the data that was given to me. Real life data is messy. One possible interpretation of your post is that you have a source of floats, where all the numbers are actually measured to the same precision, and you've simply misinterpreted the fact that some of them look like they have less precision. Another possibility is that they're latitude/longitude coordinates, some of which are given to the whole degree, some of which are given to greater precision, all the way down to the ten-thousandth of a degree. What reason do you have to think that something recorded to 14 decimal places was only intended to have been recorded to 4? Because I understand the physical measurement these numbers represent. Sometimes, Steve, you have to assume that when somebody asks a question, they actually have asked the question then intended to ask. Perhaps you need to explain why you're doing this, as it seems numerically broken. These are latitude and longitude coordinates of locations. Some locations are known to a specific street address. Some are known to a city. Some are only known to the country. So, for example, the 38.0 value represents the latitude, to the nearest whole degree, of the geographic center of the contiguous United States. I really think you need to go back to the source. Trying to infer the precision of the measurements from the accident of the string formatting seems pretty dubious to me. Sure it is. But, like I said, real-life data is messy. You can wring your hands and say, this data sucks, I can't use it, or you can figure out some way to deal with it. Which is the whole point of my post. The best I've come up with is inferring something from the string formatting and I'm hoping there might be something better I might do. But I suppose if you wanted to infer the number of digits after the decimal place, excluding trailing zeroes (why, I do not understand), up to a maximum of four digits, then you could do: s = %.4f % number # rounds to four decimal places s = s.rstrip(0) # ignore trailing zeroes, whether significant or not count = len(s.split(.)[1]) This at least seems a little more robust than just calling str(). Thank you :-) Assuming all the numbers fit in the range where they are shown in non- exponential format. They're latitude/longitude, so they all fall into [-180, 180]. Perhaps you ought to be using Decimal rather than float. Like I said, The numbers are given to me as Python floats; I have no control over that. I'm willing to accept that fact that I won't be able to differentiate between float(38.0) and float(38.). Both of those map to 1, which is OK for my purposes. That seems... well, bizarre and wrong are the only words that come to mind. I'm trying to intuit, from the values I've been given, which coordinates are likely to be accurate to within a few miles. I'm willing to accept a few false negatives. If the number is float(38), I'm willing to accept that it might actually be float(38.), and I might be throwing out a good data point that I don't need to. For the purpose I'm using the data for, excluding the occasional good data point won't hurt me. Including the occasional bad one, will. By the way, you contradict yourself here. Earlier, you described 38.0 as having zero decimal places (which is wrong). Here you describe it as having one, which is correct, and then in a later post you describe it as having zero decimal places again. I was sloppy there. I was copy-pasting data from my program output. Observe: print float(38) 38.0 In standard engineering parlance, the string 38 represents a number with a precision of +/- 1 unit. Unfortunately, Python's default str() representation turns this into 38.0, which implies +/- 0.1 unit. Floats represented as strings (at least in some disciplines, such as engineering) include more information than just the value. By the number of trailing zeros, they also include information about the precision of the measurement. That information is lost when the string is converted to a IEEE float. I'm trying to intuit that information back, and as I mentioned earlier, am willing to accept that the intuiting process will be imperfect. There is real-life value in imperfect processes. -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
2014-04-28 18:00 GMT+02:00 Roy Smith r...@panix.com: I'm using Python 2.7 I have a bunch of floating point values. For example, here's a few (printed as reprs): 38.0 41.2586 40.752801 49.25 33.7951994 36.8371996 34.1489 45.5 Fundamentally, these numbers have between 0 and 4 decimal digits of precision, and I want to be able to intuit how many each has, ignoring the obvious floating point roundoff problems. Thus, I want to map: 38.0 == 0 41.2586 == 4 40.752801 == 4 49.25 == 2 33.7951994 == 4 36.8371996 == 4 34.1489 == 4 45.5 == 1 Is there any clean way to do that? The best I've come up with so far is to str() them and parse the remaining string to see how many digits it put after the decimal point. The numbers are given to me as Python floats; I have no control over that. I'm willing to accept that fact that I won't be able to differentiate between float(38.0) and float(38.). Both of those map to 1, which is OK for my purposes. --- Roy Smith r...@panix.com Hi, I doubt, many would consider a string/regex approach very clean here, but anyway; hopefully the results conform to your specs (as far as I understood it correctly). Alternatively, the floats can be rounded before, if e.g. 39.999 could be a false positive for 4-digits precision. hth, vbr = = = = = = = for fl in (38.0, 41.2586, 40.752801, 49.25, 33.7951994, 36.8371996, 34.1489, 45.5, 40.0010, 39.0009, 39.999, 38.9, 40.0100, 41.2000, 43.0001): ... print repr(fl), ==, len(re.match(r^-?\d+\.([0-9]{0,4})(?!0), str(fl)).group(1)) ... 38.0 == 0 41.2586 == 4 40.752801 == 4 49.25 == 2 33.7951994 == 4 36.8371996 == 4 34.1489 == 4 45.5 == 1 40.001 == 3 39.0009 == 0 39.999 == 4 38.9 == 0 40.01 == 2 41.2 == 1 43.0001 == 4 = = = = = = = -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Tue, Apr 29, 2014 at 11:38 PM, Roy Smith r...@panix.com wrote: I'm trying to intuit, from the values I've been given, which coordinates are likely to be accurate to within a few miles. I'm willing to accept a few false negatives. If the number is float(38), I'm willing to accept that it might actually be float(38.), and I might be throwing out a good data point that I don't need to. You have one chance in ten, repeatably, of losing a digit. That is, roughly 10% of your four-decimal figures will appear to be three-decimal, and 1% of them will appear to be two-decimal, and so on. Is that a few false negatives? It feels like a lot IMO. But then, there's no alternative - the information's already gone. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 4/29/14 12:30 PM, Chris Angelico wrote: On Tue, Apr 29, 2014 at 11:38 PM, Roy Smith r...@panix.com wrote: I'm trying to intuit, from the values I've been given, which coordinates are likely to be accurate to within a few miles. I'm willing to accept a few false negatives. If the number is float(38), I'm willing to accept that it might actually be float(38.), and I might be throwing out a good data point that I don't need to. You have one chance in ten, repeatably, of losing a digit. That is, roughly 10% of your four-decimal figures will appear to be three-decimal, and 1% of them will appear to be two-decimal, and so on. Is that a few false negatives? It feels like a lot IMO. But then, there's no alternative - the information's already gone. Reminds me of the story that the first survey of Mt. Everest resulted in a height of exactly 29,000 feet, but to avoid the appearance of an estimate, they reported it as 29,002: http://www.jstor.org/stable/2684102 -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Wed, Apr 30, 2014 at 2:47 AM, Ned Batchelder n...@nedbatchelder.com wrote: Reminds me of the story that the first survey of Mt. Everest resulted in a height of exactly 29,000 feet, but to avoid the appearance of an estimate, they reported it as 29,002: http://www.jstor.org/stable/2684102 Yeah. Exactly the same phenomenon as I was referring to earlier when I said that you never tell someone you need to leave in five minutes - if you say six minutes, you'll be away sooner. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 2014-04-29, Roy Smith wrote: Another possibility is that they're latitude/longitude coordinates, some of which are given to the whole degree, some of which are given to greater precision, all the way down to the ten-thousandth of a degree. That makes sense. 1° of longitude is about 111 km at the equator, 78 km at 45°N or S, 0 km at the poles. A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) -- War is God's way of teaching Americans geography. [Ambrose Bierce] -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 4/29/14 3:16 PM, Adam Funk wrote: A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) Who manufactured the tent? marcus -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Tue, Apr 29, 2014 at 3:16 PM, Adam Funk a24...@ducksburg.com wrote: A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) Skin or Fur? -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Wed, Apr 30, 2014 at 6:39 AM, Mark H Harris harrismh...@gmail.com wrote: On 4/29/14 3:16 PM, Adam Funk wrote: A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) Who manufactured the tent? A man pitches his tent 1 km south and kills a bear with it. Clearly that wasn't a tent, it was a cricket ball. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
Ned Batchelder wrote: Reminds me of the story that the first survey of Mt. Everest resulted in a height of exactly 29,000 feet, but to avoid the appearance of an estimate, they reported it as 29,002: http://www.jstor.org/stable/2684102 They could have said it was 29.000 kilofeet. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 04/29/2014 01:16 PM, Adam Funk wrote: A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) From how many locations on Earth can someone walk one mile south, one mile east, and one mile north and end up at their starting point? Emile -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Wed, Apr 30, 2014 at 8:42 AM, emile em...@fenx.com wrote: On 04/29/2014 01:16 PM, Adam Funk wrote: A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) From how many locations on Earth can someone walk one mile south, one mile east, and one mile north and end up at their starting point? Any point where the mile east takes you an exact number of times around the globe. So, anywhere exactly one mile north of that, which is a number of circles not far from the south pole. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 29/04/2014 23:42, emile wrote: On 04/29/2014 01:16 PM, Adam Funk wrote: A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) From how many locations on Earth can someone walk one mile south, one mile east, and one mile north and end up at their starting point? Emile Haven't you heard of The Triangular Earth Society? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
In article mailman.9575.1398789020.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Tue, Apr 29, 2014 at 11:38 PM, Roy Smith r...@panix.com wrote: I'm trying to intuit, from the values I've been given, which coordinates are likely to be accurate to within a few miles. I'm willing to accept a few false negatives. If the number is float(38), I'm willing to accept that it might actually be float(38.), and I might be throwing out a good data point that I don't need to. You have one chance in ten, repeatably, of losing a digit. That is, roughly 10% of your four-decimal figures will appear to be three-decimal, and 1% of them will appear to be two-decimal, and so on. Is that a few false negatives? You're looking at it the wrong way. It's not that the glass is 10% empty, it's that it's 90% full, and 90% is a lot of good data :-) -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Wed, Apr 30, 2014 at 9:53 AM, Roy Smith r...@panix.com wrote: In article mailman.9575.1398789020.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Tue, Apr 29, 2014 at 11:38 PM, Roy Smith r...@panix.com wrote: I'm trying to intuit, from the values I've been given, which coordinates are likely to be accurate to within a few miles. I'm willing to accept a few false negatives. If the number is float(38), I'm willing to accept that it might actually be float(38.), and I might be throwing out a good data point that I don't need to. You have one chance in ten, repeatably, of losing a digit. That is, roughly 10% of your four-decimal figures will appear to be three-decimal, and 1% of them will appear to be two-decimal, and so on. Is that a few false negatives? You're looking at it the wrong way. It's not that the glass is 10% empty, it's that it's 90% full, and 90% is a lot of good data :-) Hah! That's one way of looking at it. At least you don't have to worry about junk digits getting in. The greatest precision you're working with is three digits before the decimal and four after, and a Python float can handle that easily. (Which is what I was concerned about when I first queried your terminology - four digits to the right of the decimal and, say, 10-12 to the left, and you're starting to see problems.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
Roy Smith r...@panix.com writes: In article mailman.9575.1398789020.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: You have one chance in ten, repeatably, of losing a digit. That is, roughly 10% of your four-decimal figures will appear to be three-decimal, and 1% of them will appear to be two-decimal, and so on. Is that a few false negatives? You're looking at it the wrong way. It's not that the glass is 10% empty, it's that it's 90% full, and 90% is a lot of good data :-) The problem is you won't know *which* 90% is accurate, and which 10% is inaccurate. This is very different from the glass, where it's evident which part is good. So, I can't see that you have any choice but to say that *any* of the precision predictions should expect, on average, to be (10 + 1 + …) percent inaccurate. And you can't know which ones. Is that an acceptable error rate? -- \ “If you don't fail at least 90 percent of the time, you're not | `\aiming high enough.” —Alan Kay | _o__) | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Wed, Apr 30, 2014 at 10:13 AM, Ben Finney b...@benfinney.id.au wrote: The problem is you won't know *which* 90% is accurate, and which 10% is inaccurate. This is very different from the glass, where it's evident which part is good. So, I can't see that you have any choice but to say that *any* of the precision predictions should expect, on average, to be (10 + 1 + …) percent inaccurate. And you can't know which ones. Is that an acceptable error rate? But they're all going to be *at least* as accurate as the algorithm says. A figure of 31.4 will be treated as 1 decimal, even though it might really have been accurate to 4; but a figure of 27.1828 won't be incorrectly reported as having only 2 decimals. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
Ben Finney b...@benfinney.id.au writes: The problem is you won't know *which* 90% is accurate, and which 10% is inaccurate. This is very different from the glass, where it's evident which part is good. Hmm. Re-reading the suggestion, I see that it is fairly predictable which estimates of precision will be inaccurate: the ones which end in explicit zeroes are more uncertain in their intended precision. -- \ “[F]reedom of speech does not entail freedom to have your ideas | `\accepted by governments and incorporated into law and policy.” | _o__) —Russell Blackford, 2010-03-06 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
In article mailman.9594.1398818045.18130.python-l...@python.org, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: in a physics or chemistry class the recommended result is 1.1 * 2.2 = 2.4 More than recommended. In my physics class, if you put down more significant digits than the input data justified, you got the problem marked wrong. (one reason slide-rules were acceptable for so long -- and even my high school trig course only required slide-rule significance even though half the class had scientific calculators [costing $100, when a Sterling slide-rule could still be had for $10]) G Sterling? Snort. KE was the way to go. -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Wed, Apr 30, 2014 at 10:37 AM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Wed, 30 Apr 2014 08:51:32 +1000, Chris Angelico ros...@gmail.com declaimed the following: Any point where the mile east takes you an exact number of times around the globe. So, anywhere exactly one mile north of that, which is a number of circles not far from the south pole. Yeah, but he'd have had to bring his own bear... Bears and Penguins don't mix. Seals, OTOH, are food to the bears, and eat the penquins. Maybe the bear was an antarctic researcher who ate Merida's cake? That'd change anyone's fate... ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
In article 8td53bxud5@news.ducksburg.com, Adam Funk a24...@ducksburg.com wrote: On 2014-04-29, Roy Smith wrote: Another possibility is that they're latitude/longitude coordinates, some of which are given to the whole degree, some of which are given to greater precision, all the way down to the ten-thousandth of a degree. That makes sense. 1° of longitude is about 111 km at the equator, 78 km at 45°N or S, 0 km at the poles. A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) Assuming he shot the bear, red. -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
In article mailman.9596.1398818760.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Wed, Apr 30, 2014 at 10:37 AM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Wed, 30 Apr 2014 08:51:32 +1000, Chris Angelico ros...@gmail.com declaimed the following: Any point where the mile east takes you an exact number of times around the globe. So, anywhere exactly one mile north of that, which is a number of circles not far from the south pole. Yeah, but he'd have had to bring his own bear... Bears and Penguins don't mix. Seals, OTOH, are food to the bears, and eat the penquins. Maybe the bear was an antarctic researcher who ate Merida's cake? That'd change anyone's fate... ChrisA The cake is a lie. -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Tue, 29 Apr 2014 09:38:33 -0400, Roy Smith wrote: What reason do you have to think that something recorded to 14 decimal places was only intended to have been recorded to 4? Because I understand the physical measurement these numbers represent. Sometimes, Steve, you have to assume that when somebody asks a question, they actually have asked the question then intended to ask. Heh, having been in *exactly* your situation of having people questioning my constraints, I can sympathise with your frustration. I was pretty frustrated too. But I've also been in situations where I've been so close to a question that I couldn't see the big picture, and a few dumb questions made me realise that in fact I was missing something obvious which changed the situation completely. To paraphrase: Me: How do I square the circle with only a compass and straightedge? Them: You can't. It's impossible. Are you sure you need only use compass and straightedge? Can you use a rolling circle and a marked ruler? Me: Come come, I've told you my requirements, compass and straightedge only. Now solve my problem! Them: Does it have to be in Euclidean space? Why don't you perform the construction in Gauss-Bolyai-Lobachevsky space? Me: Perhaps a rolling circle and ruler isn't such a bad idea... http://www.cut-the-knot.org/impossible/sq_circle.shtml http://mathworld.wolfram.com/CircleSquaring.html :-) -- Steven D'Aprano http://import-that.dreamwidth.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 04/29/2014 03:51 PM, Chris Angelico wrote: On Wed, Apr 30, 2014 at 8:42 AM, emile em...@fenx.com wrote: On 04/29/2014 01:16 PM, Adam Funk wrote: A man pitches his tent, walks 1 km south, walks 1 km east, kills a bear, walks 1 km north, where he's back at his tent. What color is the bear? ;-) From how many locations on Earth can someone walk one mile south, one mile east, and one mile north and end up at their starting point? Any point where the mile east takes you an exact number of times around the globe. So, anywhere exactly one mile north of that, which is a number of circles not far from the south pole. Perhaps my geography is rusty, but I was under the impression that one cannot travel south if one is at the South Pole (axial, not magnetic). -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Tue, 29 Apr 2014 19:31:31 -0700, Ethan Furman wrote: Perhaps my geography is rusty, but I was under the impression that one cannot travel south if one is at the South Pole (axial, not magnetic). Possibly with a rocket aimed straight up. -- Steven D'Aprano http://import-that.dreamwidth.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
In article 5360672e$0$29965$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 29 Apr 2014 19:31:31 -0700, Ethan Furman wrote: Perhaps my geography is rusty, but I was under the impression that one cannot travel south if one is at the South Pole (axial, not magnetic). Possibly with a rocket aimed straight up. No, with a rocket aimed straight up, you go north. To go south, you need a rocket aimed straight down. -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Wed, Apr 30, 2014 at 12:31 PM, Ethan Furman et...@stoneleaf.us wrote: On 04/29/2014 03:51 PM, Chris Angelico wrote: Any point where the mile east takes you an exact number of times around the globe. So, anywhere exactly one mile north of that, which is a number of circles not far from the south pole. Perhaps my geography is rusty, but I was under the impression that one cannot travel south if one is at the South Pole (axial, not magnetic). Correct, but there's a place not far from the South Pole where the circumference of the earth (travelling east) will be exactly one mile. I could calculate where that would be on a perfect sphere, but earth isn't, so I'll just say near the South Pole. If you start exactly one mile north of that circle, then you can accomplish the original challenge. Also, if your mile east takes you exactly twice around the circumference, you still achieve the same thing, so there's another circle (one mile north of *that* circle), and another at the three-times-around circle, etc. But I think a better answer is New York City. You start out lost, you go a mile south, a mile east, a mile north, and you are again lost. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Wed, Apr 30, 2014 at 1:30 PM, Roy Smith r...@panix.com wrote: In article 5360672e$0$29965$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 29 Apr 2014 19:31:31 -0700, Ethan Furman wrote: Perhaps my geography is rusty, but I was under the impression that one cannot travel south if one is at the South Pole (axial, not magnetic). Possibly with a rocket aimed straight up. No, with a rocket aimed straight up, you go north. To go south, you need a rocket aimed straight down. If I ever go travelling with you guys, I am NOT letting you navigate. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 4/28/14 12:00 PM, Roy Smith wrote: Fundamentally, these numbers have between 0 and 4 decimal digits of precision, and I want to be able to intuit how many each has, ignoring the obvious floating point roundoff problems. Thus, I want to map: 38.0 == 0 41.2586 == 4 40.752801 == 4 49.25 == 2 33.7951994 == 4 36.8371996 == 4 34.1489 == 4 45.5 == 1 Is there any clean way to do that? The best I've come up with so far is to str() them and parse the remaining string to see how many digits it put after the decimal point. That sounds like a pretty clean way: len(str(num).partition(.)[2]), though it also sounds like you understand all of the inaccuracies in that technique. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Tue, Apr 29, 2014 at 2:00 AM, Roy Smith r...@panix.com wrote: I have a bunch of floating point values. For example, here's a few (printed as reprs): 38.0 41.2586 40.752801 49.25 33.7951994 36.8371996 34.1489 45.5 Fundamentally, these numbers have between 0 and 4 decimal digits of precision... Terminology question: Why do you count only what's after the decimal point? I would describe these as having between 2 and 6 significant figures. Will they always have two digits before the decimal, or does your precision really care only about what's after it? Of course, there would still remain the problem of describing 49.25 with 6 sig figs, in the same way that it's hard to explain to someone that you really do need to leave in five minutes (but if you said you had to leave in six minutes, they'd believe you to be accurate to the minute). But I assume that's not part of the question. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Monday, April 28, 2014 12:28:59 PM UTC-4, Chris Angelico wrote: Terminology question: Why do you count only what's after the decimal point? I would describe these as having between 2 and 6 significant figures. Will they always have two digits before the decimal, or does your precision really care only about what's after it? Hmmm, yeah, I was being sloppy in my description. Definitely would have gotten points off in physics class for being so sloppy :-) No, there's not always two digits before the decimal. Could be anywhere from 0 to 3 digits before. What I'm really after is how many digits are after the decimal point. -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Monday, April 28, 2014 12:07:14 PM UTC-4, Ned Batchelder wrote: On 4/28/14 12:00 PM, Roy Smith wrote: 38.0 == 0 [...] Is there any clean way to do that? The best I've come up with so far is to str() them and parse the remaining string to see how many digits it put after the decimal point. That sounds like a pretty clean way: len(str(num).partition(.)[2]), though it also sounds like you understand all of the inaccuracies in Well, it's actually, a little uglier, because I want to map 38.0 ==0, so I need to special case that. The other annoying thing about using str() is its behavior isn't well defined. It looks like it does the right thing, but I imagine the details could change in a different implementation. -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On 4/28/14 2:39 PM, Roy Smith wrote: On Monday, April 28, 2014 12:07:14 PM UTC-4, Ned Batchelder wrote: On 4/28/14 12:00 PM, Roy Smith wrote: 38.0 == 0 [...] Is there any clean way to do that? The best I've come up with so far is to str() them and parse the remaining string to see how many digits it put after the decimal point. That sounds like a pretty clean way: len(str(num).partition(.)[2]), though it also sounds like you understand all of the inaccuracies in Well, it's actually, a little uglier, because I want to map 38.0 ==0, so I need to special case that. Ah, right. The other annoying thing about using str() is its behavior isn't well defined. It looks like it does the right thing, but I imagine the details could change in a different implementation. I don't have a reference, but in recent Pythons, str() was specifically changed to guarantee that it produces the shortest string that when re-interpreted as a float, produces the same float. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Mon, 28 Apr 2014 12:00:23 -0400, Roy Smith wrote: [...] Fundamentally, these numbers have between 0 and 4 decimal digits of precision, I'm surprised that you have a source of data with variable precision, especially one that varies by a factor of TEN THOUSAND. The difference between 0 and 4 decimal digits is equivalent to measuring some lengths to the nearest metre, some to the nearest centimetre, and some to the nearest 0.1 of a millimetre. That's very unusual and I don't know what justification you have for combining such a mix of data sources. One possible interpretation of your post is that you have a source of floats, where all the numbers are actually measured to the same precision, and you've simply misinterpreted the fact that some of them look like they have less precision. Since you indicate that 4 decimal digits is the maximum, I'm going with 4 decimal digits. So if your data includes the float 23.5, that's 23.5 measured to a precision of four decimal places (that is, it's 23.5000, not 23.5001 or 23.4999). On the other hand, if you're getting your values as *strings*, that's another story. If you can trust the strings, they'll tell you how many decimal places: 23.5 is only one decimal place, 23.5000 is four. But then what to make of your later example? 40.752801 == 4 Python floats (C doubles) are quite capable of distinguishing between 40.7528 and 40.752801. They are distinct numbers: py 40.752801 - 40.7528 7.105427357601002e-15 so if a number is recorded as 40.752801 presumably it is because it was measured as 40.752801. (How that precision can be justified, I don't know! Does it come from the Large Hadron Collider?) If it were intended to be 40.7528, I expect it would have be recorded as 40.7528. What reason do you have to think that something recorded to 14 decimal places was only intended to have been recorded to 4? Without knowing more about how your data is generated, I can't advise you much, but the whole scenario as you have described it makes me think that *somebody* is doing something wrong. Perhaps you need to explain why you're doing this, as it seems numerically broken. Is there any clean way to do that? The best I've come up with so far is to str() them and parse the remaining string to see how many digits it put after the decimal point. I really think you need to go back to the source. Trying to infer the precision of the measurements from the accident of the string formatting seems pretty dubious to me. But I suppose if you wanted to infer the number of digits after the decimal place, excluding trailing zeroes (why, I do not understand), up to a maximum of four digits, then you could do: s = %.4f % number # rounds to four decimal places s = s.rstrip(0) # ignore trailing zeroes, whether significant or not count = len(s.split(.)[1]) Assuming all the numbers fit in the range where they are shown in non- exponential format. If you have to handle numbers like 1.23e19 as well, you'll have to parse the string more carefully. (Keep in mind that most floats above a certain size are all integer-valued.) The numbers are given to me as Python floats; I have no control over that. If that's the case, what makes you think that two floats from the same data set were measured to different precision? Given that you don't see strings, only floats, I would say that your problem is unsolvable. Whether I measure something to one decimal place and get 23.5, or four decimal places and get 23.5000, the float you see will be the same. Perhaps you ought to be using Decimal rather than float. Floats have a fixed precision, while Decimals can be configured. Then the right way to answer your question is to inspect the number: py from decimal import Decimal as D py x = D(23.5000) py x.as_tuple() DecimalTuple(sign=0, digits=(2, 3, 5, 0, 0, 0), exponent=-4) The number of decimal digits precision is -exponent. I'm willing to accept that fact that I won't be able to differentiate between float(38.0) and float(38.). Both of those map to 1, which is OK for my purposes. That seems... well, bizarre and wrong are the only words that come to mind. If I were recording data as 38. and you told me I had measured it to only one decimal place accuracy, I wouldn't be too pleased. Maybe if I understood the context better? How about 38.12 and 38.1200? By the way, you contradict yourself here. Earlier, you described 38.0 as having zero decimal places (which is wrong). Here you describe it as having one, which is correct, and then in a later post you describe it as having zero decimal places again. -- Steven D'Aprano http://import-that.dreamwidth.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: By the way, you contradict yourself here. Earlier, you described 38.0 as having zero decimal places (which is wrong). Here you describe it as having one, which is correct, and then in a later post you describe it as having zero decimal places again. I get the impression that this is at the core of the misunderstanding. Having a number's representation ending in “….0” does not mean zero decimal places; it has exactly one. The value's representation contains the digit “0” after the decimal point, but that digit is significant to the precision of the representation. If the problem could be stated such that “38.0” and “38” and “38.000” are consistently described with the correct number of decimal digits of precision (in those examples: one, zero, and three), maybe the discussion would make more sense. -- \ “Men never do evil so completely and cheerfully as when they do | `\it from religious conviction.” —Blaise Pascal (1623–1662), | _o__) Pensées, #894. | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Significant digits in a float?
On Tue, 29 Apr 2014 13:23:07 +1000, Ben Finney wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: By the way, you contradict yourself here. Earlier, you described 38.0 as having zero decimal places (which is wrong). Here you describe it as having one, which is correct, and then in a later post you describe it as having zero decimal places again. I get the impression that this is at the core of the misunderstanding. Having a number's representation ending in “….0” does not mean zero decimal places; it has exactly one. The value's representation contains the digit “0” after the decimal point, but that digit is significant to the precision of the representation. If the problem could be stated such that “38.0” and “38” and “38.000” are consistently described with the correct number of decimal digits of precision (in those examples: one, zero, and three), maybe the discussion would make more sense. It's actually trickier than that. Digits of precision can refer to measurement error, or to the underlying storage type. Python floats are C doubles, so they have 64 bits of precision (approximately 17 decimal digits, if I remember correctly) regardless of the precision of the measurement. The OP (Roy) is, I think, trying to guess the measurement precision after the fact, given a float. If the measurement error really does differ from value to value, I don't think he'll have much luck: given a float like 23.0, all we can say is that it has *at least* zero significant decimal places. 23.1 has at least one, 23. has at least four. If you can put an upper bound on the precision, as Roy indicates he can, then perhaps a reasonable approach is to convert to a string rounded to four decimal places, then strip trailing zeroes: py x = 1234.1 # actual internal is closer to 1234.009 py (%.4f % x).rstrip('0') '1234.1' then count the number of digits after the dot. (This assumes that the string formatting routines are correctly rounded, which they should be on *most* platforms.) But again, this only gives a lower bound to the number of significant digits -- it's at least one, but might be more. -- Steven -- https://mail.python.org/mailman/listinfo/python-list