Integration Times "Old" 33s vs "New" 33s - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: Integration Times "Old" 33s vs "New" 33s (/thread-84206.html) Integration Times "Old" 33s vs "New" 33s - John Smitherman - 12-12-2005 It appears that HP has improved the speed of the integration function on the latest version of the 33s. Working through a couple of the integration torture tests found at http://www.voidware.com/calcs/torture_integration.htm I recorded the following times for my "old" vs "new" 33s: 1. integral cos(ln(x)) from 0 to 1 radians, fixed at 5 places Old 33s (s/n 417): 4 min 58 sec New 33s (s/n 524): 2 min 27 sec 2. integral sqrt(abs(x-1)) from 0 to 2, fixed at 5 places Old 33s (s/n 417): 10 min 02 sec New 33s (s/n 524): 5 min 00 sec Has anyone else seen this type of improvement? Couple this with an improved display, improved keypad and bug fixes and I am pleased with the 33s. Thank you HP, John Re: Integration Times "Old" 33s vs "New" 33s - ECL - 12-12-2005 I have three 33s' (one is the newer revision). The display is significantly improved. I can't speak for old vs. new 33s, but I am very satisfied with the speed over the 32sii. Yes, thanks, HP, for the 33s! ECL Re: Integration Times "Old" 33s vs "New" 33s - Marcus von Cube, Germany - 12-13-2005 John, if you look at the execution times, they seem to be exactly halved, as if the clock speed had been doubled. Can you check with a simple loop, if the hardware has been made faster? Marcus Re: Integration Times "Old" 33s vs "New" 33s - Valentin Albillo - 12-13-2005 Hi, John: If you want a real "integration torture-test", try and compute this simple integral: ``` Integral between 0 and 1 of f(x) = Cos(Ln(x)/x)/x = 0.3233674316 7777876139 9370087952 1704466510+ (Ln(x) is the natural, base-e logarithm, of course) ``` and see how many correct digits do you get, in whatever machine, using whatever method. Marcus von Cube passed on this one when I proposed it to him, seems he couldn't make a dent ! :-) Best regards from V. Re: Integration Times "Old" 33s vs "New" 33s - John Smitherman - 12-13-2005 Quote: John, if you look at the execution times, they seem to be exactly halved, as if the clock speed had been doubled. Can you check with a simple loop, if the hardware has been made faster? Marcus Hi Marcus. I wrote a quick program to loop 1000 times and recorded the execution times as follows: "Old" 33s: 21 seconds "New" 33s: 10 seconds So, it appears that the hardware/software is faster for these functions. Regards, John Re: Integration Times "Old" 33s vs "New" 33s - Ed Look - 12-13-2005 I also wonder what cutoff serial number value constitutes the boundary between new model and old model. Re: Integration Times "Old" 33s vs "New" 33s - Greg Whitfield - 12-13-2005 All three of my HP 33s calculators: (1) s/n 428 (from amazon.com with old display and flakey 1 key that HP didn't want back) (2) s/n 442 (marketing sample HP sent me as replacement with new display) (3) s/n 532 (from Wal-Mart with new display) execute the integral of cos(ln(x)) in around 2 min 25 sec. -Greg 33S vs. 32S/32SII integ times (improvement ??) - Karl Schneider - 12-14-2005 Quote: integral cos(ln(x)) from 0 to 1 radians, fixed at 5 places Old 33s (s/n 417): 4 min 58 sec New 33s (s/n 524): 2 min 27 sec John -- First, a nitpick. The limits are simply 0 to 1, not 0 to 1 radians. Angular measures apply only for trigonometric fucntions, and cosine is taken here on the output of the natural logarithm. Hmm, this is progress? I programmed cos(ln x) as an RPN program on the 32SII and 32S today, using 5 and 6 decimal places. The 32S is a little faster, I've found, and SOLVE/INTEG with RPN functions is faster than SOLVE/INTEG using equations on the 32SII (equations are not available on the 32S). The correct answer is 0.5 exactly, which can be determined by two applications of integration by parts. The 32S and 32SII gave the same answers: ``` FIX 5 FIX 6 Answer 0.50000696243 0.49999965858 Est. Error 0.00000500000 0.00000050000 Time (32S) 1:06 minutes 4:22 minutes ``` Note that the answer provided under FIX 5 is not within the estimated error of the correct answer. However, FIX 6 does give an answer "within bounds". I had found the same thing with the difficult function integrated between 0 and 1, which is described in the 1980 HP Journal article on the HP-34 SOLVE, repeated in the HP-15C Advanced Functions Handbook and the HP-71B Math ROM manual: ``` sqrt(x) 1 f(x) = ------- - ----- (x-1) ln(x) ``` -- KS Re: Integration Times "Old" 33s vs "New" 33s - Marcus von Cube, Germany - 12-14-2005 Valentin, Quote: Marcus von Cube passed on this one when I proposed it to him, seems he couldn't make a dent ! :-) This function isn't made to be numerically integrated! My TI-84 stops early (less than a minute) with a "Tolerance no met" error (tolerance set to 1E-4). My Voyage 200 is still trying. Early in the process, a "Questionable accuracy" warning from the trig functions appeared on the status line. I guess it will drain the batteries before it gives up. The HP 49g+ is still trying (SCI 4). I think it is in the same leage as my Voyage 200. A newly acquired Sharp EL-5120 quits early with an "ERROR 02", trying to evaluate ln(0). None of my symbolic calcs was able to find a symbolic solution for the indefinite integral. Does one exist? Marcus Re: Integration Times "Old" 33s vs "New" 33s - Valentin Albillo - 12-14-2005 Hi, Marcus: Marcus posted: "This function isn't made to be numerically integrated!" Don't blame this innocent function. I've seen worse. "My TI-84 stops early (less than a minute) with a "Tolerance no met" error (tolerance set to 1E-4)." What would you expect from a Texas Instruments ? "My Voyage 200 is still trying. Early in the process, a "Questionable accuracy" warning from the trig functions appeared on the status line. I guess it will drain the batteries before it gives up." They might, indeed. But what would you expect from a Voyage 200 ? "The HP 49g+ is still trying (SCI 4). I think it is in the same leage as my Voyage 200." Now you've gone too far. Please don't insult poor Voyage 200. "A newly acquired Sharp EL-5120 quits early with an "ERROR 02", trying to evaluate ln(0)." What would you expect from a SHARP? Naw, *this* time I'm joking. "None of my symbolic calcs was able to find a symbolic solution for the indefinite integral. Does one exist?" As far as I know, no symbolic solution or closed form does exist. For the record, the HP-71B in "naive" mode produces: ``` >INTEGRAL(0,1,1E-2,COS(LN(IVAR)/IVAR)/IVAR) .167473677804 >INTEGRAL(0,1,1E-5,COS(LN(IVAR)/IVAR)/IVAR) .169114784125 >INTEGRAL(0,1,1E-12,COS(LN(IVAR)/IVAR)/IVAR) .169114784125 ``` all of them utterly wrong. However, thou shalt not give up. Try and conquer this integral by whatever means (variable substitution, expansions, interval subdivision, whatever) or recognize shameful defeat for you and your puny machines ! :-) (Not for me: using one of several appropriate, "non-naive" approaches, I can get 12 correct digits with an HP-71B very fast, and even an HP-15C can do it relatively fast as well) Best regards from V. Edited: 14 Dec 2005, 9:18 a.m. Re: Integration Times "Old" 33s vs "New" 33s - bill platt - 12-14-2005 Or in other words, Real maths has nothing to do with calculators per se, but with the *brain* Re: Integration Times "Old" 33s vs "New" 33s - Valentin Albillo - 12-14-2005 Hi, Bill: Bill posted: "Or in other words, real maths has nothing to do with calculators per se, but with the *brain* " Yes, that's more or less correct. Oftentimes, a savvy individual will do with an HP-15C what a less knowledgeable one couldn't, even with a 49G+ or three. This simple integral is probably such a case (and I'm not talking about Marcus von Cube, who undoubtely will soon find the proper way to deal with it). Best regards from V. Re: Integration Times "Old" 33s vs "New" 33s - Marcus von Cube, Germany - 12-14-2005 Hi Valentin, I've already spent some time on the integral, dusting off areas of my brain which had been in deep sleep over decades! A simple aproach is to replace the lower boundary by something above zero, e.g. 10^-2 (result: 0.325). Smaller boundaries make things worse! Variable substitution doesn't seem to get rid of the oscillations and I get an infinite boundary instead. I just had a look into taylor series expansion. That might do the trick. There are ways to tackle such problems by integrating in the complex plane but that's beyond my powers, at least for now... Marcus Re: Integration Times "Old" 33s vs "New" 33s - John Smitherman - 12-14-2005 Quote: All three of my HP 33s calculators: (1) s/n 428 (from amazon.com with old display and flakey 1 key that HP didn't want back) (2) s/n 442 (marketing sample HP sent me as replacement with new display) (3) s/n 532 (from Wal-Mart with new display) execute the integral of cos(ln(x)) in around 2 min 25 sec. -Greg Hi Greg. I believe that I've solved the mystery... I replaced the batteries on my old 33s with new batteries and the integral execute times are the same on my old and new 33s. I tried to execute Valentin's torture test of cos(ln(x)/x)/x and the battery symbol popped up on the display. After 2 or 3 hours the calculator locked up blinking the "memory cleared" message. I measured the voltages on the old batteries as 2.7 and 2.4 volts. The new replacement batteries measured 3.3 and 3.3 volts. Strange but true! Regards, John "Torture" integral solved - Valentin Albillo - 12-15-2005 Hi, Marcus: Marcus posted: "A simple aproach is to replace the lower boundary by something above zero [...] Smaller boundaries make things worse!" Yes, they do. That the result you get with your lower boundary somewhat resembles the correct value is just a coincidence. "Variable substitution doesn't seem to get rid of the oscillations and I get an infinite boundary instead." True, but this is one possible way to deal with this integral. The change: ``` t = -log(x) ``` results in: ``` Integral = Integral(0, Inf, cos(t.et)) = Integral(0, Inf, cos(W-1(t))) ``` where W(x) is Lambert's W function. You can then find the integral by subdividing the (0,Inf) original interval in subintervals and thus integrating between the zeros of cos(W-1(t)), thus getting an slowly convergent alternating series that can be accelerated by a number of methods (see my HP-11C Datafile article, for example). This results in an accurate value for the integral but, as you correctly guessed, there's a faster, simpler way: "There are ways to tackle such problems by integrating in the complex plane" That's right. You just need to remember that ``` eix = cos(x) + i*sin(x) ``` and the original integral becomes: ``` Integral = Integral(0, 1, RealPart(e(i*log(x)/x)/x)) = Integral(0, 1, RealPart(xi/x-1)) ``` which can readily be integrated by considering it a line integral in the complex plane along some integration path. A simple parabolic path will do:``` z = t + t*(1-t)*i ``` which takes us far from the oscillations of the real line. Using this path, your faithful HP-71B can compute the integral to full 12-digit precision in a few minutes, as follows: ``` 10 DESTROY ALL @ COMPLEX Z @ SFLAG -1 @ DISP INTEGRAL(0,1,1E-9,FNY(IVAR)) 20 DEF FNY(T) @ Z=(T,T-T*T) @ FNY=REPT(Z^((0,1)/Z-1)*(1,1-2*T)) >RUN .323367431678 ``` which, as stated, is the correct result rounded to the 12 decimal digits shown. The HP-15C solution is a mere verbatim translation of this 2-line 'program'. This technique of computing difficult real-line integrals by taking them to the complex plane is actually very useful in many situations, and is discussed at length, with an example, in the marvelous HP-15C Advanced Functions Handbook. Thanks for your interest and best regards from V. Edited: 15 Dec 2005, 9:19 a.m. Re: "Torture" integral solved - Marcus von Cube, Germany - 12-15-2005 Thanks Valentin, I've just sent your post to my printer. Maybe the complex trick can be ported to other calculators with complex number functions, too. But don't hold your breath! Marcus BTW, A printout of the HP 15C Adv. Functions Handbook lies on my desk. It just waits to be read... Marcus Re: "Torture" integral solved - Valentin Albillo - 12-15-2005 Hi again, Marcus: Marcus posted: "Maybe the complex trick can be ported to other calculators with complex number functions, too. But don't hold your breath!" I'm sure it'll port easily, at least to the HP42S. Perhaps you'd like to try and create an RPL version. "A printout of the HP 15C Adv. Functions Handbook lies on my desk. It just waits to be read..." It should be a compulsory read for any HP-calc math-oriented programmer, regardless of the particular HP model, as it includes such a wealth of truly advanced material (well, ignoring their pathetic 'create a unit matrix' attempt, of course) :-) Best regards from V. Re: "Torture" integral *NOT* solved in RPL - Marcus von Cube, Germany - 12-16-2005 Hi Valentin, bad news! I tried two versions of the complex path solution in RPL on my 49g+ and both failed miserably. The results obtained after several hours of battery draining computation were disastrous: -1.7*10^495 & -1.3*10^495, respectively. I guess, someone else has to have a close look at what I've done: Defining the complex path ```'Z(T)=T+(SQ(T)-T)*i' DEFINE ``` This creates a program P wich takes a parameter T from the stack and outputs a complex result, a point on a parabola in the complex plane. SQ(T) is TÂ². i can be entered as (0,1) or "left shift"+"TOOL". DEFINE is executed by pressing "left shift"+"2". Z(0)=0 and Z(1)=1, both on the real axis. Defining the function to integrate Version 1: ```'BAD(Z)=COS(LN(Z)/Z)/Z' DEFINE ``` Version 2: ```'BAD2(Z)=Z^(i/Z-1)' DEFINE ``` Integrate Note: INTEG is the integral symbol "right shift" "TAN". I had to set complex mode by setting flag -103. ```INTEG(0,1,RE(BAD(Z(X)),X) ``` repectively ```INTEG(0,1,RE(BAD2(Z(X)),X) ``` Both integrals yield the above mentioned "results." Can you comment on this? Marcus Edited: 16 Dec 2005, 5:06 p.m. Re: "Torture" integral *NOT* solved in RPL - Valentin Albillo - 12-16-2005 Hi, Marcus: Marcus posted: "Can you comment on this ?" Yes. I have no 48/49, of course, but here are two comments for you: "Defining the complex path: 'Z(T)=T+(SQ(T)-T)*i'" You've got the wrong sign for the imaginary component, it should be:``` 'Z(T)=T+(T-SQ(T))*i' ``` "Defining the function to integrate 'BAD2(Z)=Z^(i/Z-1)'" Wrong again. You're missing the necessary multiplication times the derivative of "Z(t)" with respect to "t", i.e.: ``` Z^(i/Z-1)*(1+(1-2*T)*i) ``` Both can be seen in the HP-71B code I posted. Make the above changes and see if that helps. Best regards from V. Re: "Torture" integral *NOT* solved in RPL - Marcus von Cube, Germany - 12-17-2005 Valentin, Quote: You're missing the necessary multiplication times the derivative of "Z(t)" with respect to "t" You're right, I didn't read your post thorougly enough! I've added the term to the integral expression inside the RE() part. My calc is still working on it... I din't change the sign of the complex path because that shouldn't make a difference (hopefully.) Marcus P.S.: I'll be back with the results later. P.P.S.: Last night, my 49g+ failed, while computing, with "low battery" and lost the stack and command history. I've just changed batteries but didn't reenter the integral, yet. Edited: 18 Dec 2005, 4:38 a.m. Re: "Torture" integral now solved (not only in RPL) - Marcus von Cube, Germany - 12-19-2005 Hi Valentin, to make clear what happens in the complex plane, I played around with the graphing functions of Derive 6 in the PC. Now I know better! The real part of the original function COS(LN(x)/x)/x oscillates along the real axis as well as along the i-Axis. So no matter what path the integration takes, the numerical results are useless. The "corrected" function x^(i/x-1) is asymetric with respect to the i-axis: its real part oscillates heavily on the negative i-side (below the real axis) and is smooth above. Therefore, the results depend heavily upon the path taken through the complex plane. I could easily reproduce your results with Derive and on my 49g+ after I had corrected the sign of the imaginary part of the path function. That was an interesting matter! Re: "Torture" integral now solved (not only in RPL) - Valentin Albillo - 12-19-2005 Hi, Marcus: Marcus posted: "Therefore, the results depend heavily upon the path taken through the complex plane. I could easily reproduce your results with Derive and on my 49g+ after I had corrected the sign of the imaginary part of the path function." See ? I told you ... :-) "That was an interesting matter! " I'm glad you enjoyed it, and thanks for trying it out. Best regards from V.