The Museum of HP Calculators

HP Forum Archive 21

 Check on mathematical identityMessage #1 Posted by Namir on 23 Aug 2012, 9:28 p.m. Hi All, Is the following identity correct? Log(1+x) = x / AGM(1, x) Log could be either ln(x) or log10(x). AGM is the average-geometric mean function (see here for definition). Namir

 Re: Check on mathematical identityMessage #2 Posted by Gerson W. Barbosa on 23 Aug 2012, 10:03 p.m.,in response to message #1 by Namir If the identity were true then AGM(1, x) = x/Log(1+x) Now, if x=1 then AGM(1, 1) = 1/Log(1+x) 1 = 1/Log(2) --> Log(2) = 1 But either ln(2) or log102 are different than 1. Therefore the identity does not hold.

 Re: Check on mathematical identityMessage #3 Posted by Crawl on 23 Aug 2012, 10:29 p.m.,in response to message #1 by Namir Why would you guess that was the case? In any case, the Wikipedia article itself mentions that AGM can be expressed in terms of an elliptic integral, which itself cannot be expressed as an elementary function, so there is no hope of it simplifying to log.

 Re: Check on mathematical identityMessage #4 Posted by Paul Dale on 24 Aug 2012, 12:10 a.m.,in response to message #3 by Crawl AGM is one method that is used to calculate log to high accuracy. The 34S used this algorithm for a while. The 34S also has an AGM function built in. - Pauli

 Re: Check on mathematical identityMessage #5 Posted by Namir on 24 Aug 2012, 8:25 a.m.,in response to message #4 by Paul Dale Pauli, Yep ... that equation sure works!! I set m to 16 and got very good results. Thanks! Namir Edited: 24 Aug 2012, 8:45 a.m.

 Re: Check on mathematical identityMessage #6 Posted by Paul Dale on 24 Aug 2012, 7:32 p.m.,in response to message #5 by Namir I had to set m much higher to get accurate enough results for single precision. I don't remember exactly what I set it to though. - Pauli

 Re: Check on mathematical identityMessage #7 Posted by Namir on 24 Aug 2012, 10:52 a.m.,in response to message #4 by Paul Dale What algorithm does the WP32S currently use? Namir

 Re: Check on mathematical identityMessage #8 Posted by Walter B on 24 Aug 2012, 12:54 p.m.,in response to message #7 by Namir Quote: What algorithm does the WP32S currently use? Dunno ;-)

 Re: Check on mathematical identityMessage #9 Posted by Namir on 24 Aug 2012, 4:31 p.m.,in response to message #8 by Walter B Shammas Polynomials???????????!!!!!!!!!!!!

 Re: Check on mathematical identityMessage #10 Posted by Walter B on 24 Aug 2012, 5:27 p.m.,in response to message #9 by Namir No idea. I simply don't know a WP32S ;-)

 Re: Check on mathematical identityMessage #11 Posted by Paul Dale on 24 Aug 2012, 7:38 p.m.,in response to message #7 by Namir The comment before the natural logarithm function from the 34S source code is: ```/* Natural logarithm. * * Take advantage of the fact that we store our numbers in the form: m * 10^e * so log(m * 10^e) = log(m) + e * log(10) * do this so that m is always in the range 0.1 <= m < 2. However if the number * is already in the range 0.5 .. 1.5, this step is skipped. * * Then use the fact that ln(x^2) = 2 * ln(x) to range reduce the mantissa * into 1/sqrt(2) <= m < 2. * * Finally, apply the series expansion: * ln(x) = 2(a+a^3/3+a^5/5+...) where a=(x-1)/(x+1) * which converges quickly for an argument near unity. */ ``` I don't remember making any any other refinements but might have. This is around line 750 of decn.c if you want to look at the actual code. The native decNumber library uses Newton's method after an initial estimate and this proved very slow. I then switched to the AGM code which was faster but quite a bit less accurate. I later moved to the current code which is both faster again and accurate. Even so, our code for the natural logarithm is on the slow side and a faster method would be appreciated. Unfortunately, I can't justify the use of tables of piecewise polynomial or rational approximations which seem to be the typical way to implement this function. - Pauli

 Re: Check on mathematical identityMessage #12 Posted by Les Koller on 25 Aug 2012, 6:23 p.m.,in response to message #1 by Namir On the advice of several of you users a couple weeks ago. in response to a query I posed, I purchased An Atlas of Functions, 2nd Edition, by Oldham, Myland, and Spanier. I just began to peruse the book last night (did I say I got a BRAND NEW COPY from Alibris.com for just 99 cents + s&h!!) and within 15 pages came upon a mean I had never heard of...the arithmeticogeometric mean. The text does not go a lot in to detail for the mean. Is this the same mean as the AGM? If so what a major coincidence! I am really enjoying this text. Whomever told me it is "imminently more readable" than other texts was exactly right. Question, my copy came with Equator, the Atlas Function Calculator software on CD. I will probably never need it, but decided to install it anyway. Would not work with my machine (Windows 7 Home Premium 64-bit). Has anyone successfully installed Equator on Windows 7?

 Re: Check on mathematical identityMessage #13 Posted by Paul Dale on 25 Aug 2012, 7:17 p.m.,in response to message #12 by Les Koller Yes, this is the same as the AGM. I've no ideas about the software CD, I've not yet used it and doubt I ever will. - Pauli

 Re: Check on mathematical identityMessage #14 Posted by Les Koller on 25 Aug 2012, 8:42 p.m.,in response to message #13 by Paul Dale Hey Pauli, yea, you told me that in an email. Thanks for suggesting the book and being sure I got the right one. It is an amazing reference as well as being a very beautifully done product. I usually install the software that comes with texts like these, play with them for 1/2, maybe a whole hour, then delete the file and archive the CD. Just bothered me that this one would not install, in spite of being fairly recent (2008 I believe it was?).

 Re: Check on mathematical identityMessage #15 Posted by LHH on 25 Aug 2012, 9:50 p.m.,in response to message #14 by Les Koller Windows 7 is starting to scare me and I don't even have it yet! I still run XP on all my systems and they have been and still are absolutely trouble-free. Still I am ordering a laptop and have no choice but to get it with Win7 already installed. Many friends and business aquaintances have mentioned all sorts of troubles with Win7 so I'm a bit apprehensive about it. Does Win7 have some (backward) compatibility settings when running programs? 2008 doesn't sound that long ago but, thanks to Moore's Law and Microsoft programmers creating bloated code in the same style as our deficit spending, it's almost ancient history!

 Re: Check on mathematical identityMessage #16 Posted by Les Koller on 25 Aug 2012, 10:05 p.m.,in response to message #15 by LHH Windows 7 has the full complement of Run in Windows XXX Compatibility Modes and, as with the Compatibility function of every Windows edition ever written, NONE of them work. Ever.

 Re: Check on mathematical identityMessage #17 Posted by LHH on 25 Aug 2012, 10:34 p.m.,in response to message #16 by Les Koller That's part of the reason I keep my old machines. I have a DOS/Win 3.1-based 486 system with 5.25"/3.5" floppy drives and a couple of Pentium Win 98 machines. All still work and have come in handy. I recently extracted some old CAD drawings in .dxf from the old DOS machine and was able to import them into very current CAD programs with few problems. I also have a copy of this book coming so I'll see what happens in XP. I suppose you have checked online for a possible patch or updated version (not that we really need this calc anyway though I suppose)?

 Re: Check on mathematical identityMessage #18 Posted by Les Koller on 26 Aug 2012, 12:19 a.m.,in response to message #17 by LHH Yes, I have completed a fairly thorough google search to no avail. I will keep looking, for a day or two.

 Re: Check on mathematical identityMessage #19 Posted by Pete Wilson on 26 Aug 2012, 12:25 a.m.,in response to message #16 by Les Koller I find it works fine, and there is always XP Mode if you have Pro... In any case, without compatibility mode I wouldn't have been able to program my WP-34s using a serial cable.

 Re: Check on mathematical identityMessage #20 Posted by LHH on 26 Aug 2012, 1:04 a.m.,in response to message #19 by Pete Wilson How XP-like is it? One big problem my company has had involves Win7 problems with MIDI files and the Audio control panel in general (or should I say the lack thereof). We have firmware updates distributed as MIDI SYSEX files and they work perfectly in XP. Unfortunately they stopped working at all in Win7 (even when using some of the workarounds we've found on the Internet). It's hard to believe all the problems these version changes can cause. I spent almost a year with a brand new Dell and Windows ME trying to get some audio recording software to work. I finally installed Win 2000 and it all worked perfectly. No one could ever explain why and ME was pretty quickly abandoned. Unfortunately I happened to be one of the early adopters (and paid the price for it too!).

 Re: Check on mathematical identityMessage #21 Posted by Les Koller on 26 Aug 2012, 9:50 a.m.,in response to message #19 by Pete Wilson Pete, glad the compatibility mode worked for you. I have several, probably thousands, of files laying around here that I would love to use. When they do not run natively on a newer version of Windows, I have NEVER gotten them to work in compatibility mode. That's why, this weekend, with 650GB free space on my HDD, I am installing a dual-boot system with 7 and XP. Quickest way I know to have both.

 Re: Check on mathematical identityMessage #22 Posted by Les Koller on 26 Aug 2012, 11:21 a.m.,in response to message #21 by Les Koller OK, setting up a dual boot system with 7 and XP is just not worth the effort. Windows 7 Pro upgrade is about 100 bucks. I have two older systems in the house that are XP machines, missing various parts. Now, looks like I'll cobble together one machine from the two. I have tried VMWare before and had it eat a lot of data for dinner, not messing with that crap again. If didn't find 6 or 8 files a week I want to run, that will not run outside XP, I wouldn't bother.

Go back to the main exhibit hall