Improper Integrals with the HP-15C LE & CE
|
11-13-2023, 03:00 PM
Post: #1
|
|||
|
|||
Improper Integrals with the HP-15C LE & CE
In a thread-based conversaion with Valentin Albillo, Valentin mentioned some improper intgerals to test with the 16-point Gaussian Quadrature (the subject of that thread in the HP-41C software) that I had posted. I decided to test some of these integrals with the fast HP-15 LE and CE. Here are the reslts!
intgeral of 1/sqrt(x) for x = 0 to 1 (accurate solution is 2) HP-15 LE gave 1.9998705 HP-15C CE gave no solution intgeral of cos(x)*log(x) for x = 0 to 1 (correct is -0.9460830703670) HP-15C CE gave -0.946082894 HP-15C LE gave -0.946083028 (slighly more accurate) intgeral of 1/√(-Ln(x)) (correct is 1.77245385091) HP-15C CE gave no solution HP-15C LE gave no solution In the case where I noted that a calculator "gave no solution" the machine kept running for several minutes flashing "running". Given that the LE and CE are fast calculators, one would expect a relatively quick answer (even if it is a rough approximation). Namir |
|||
11-13-2023, 03:32 PM
Post: #2
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE | |||
11-13-2023, 03:42 PM
(This post was last modified: 11-13-2023 03:55 PM by Divasson.)
Post: #3
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE
Using the integrate feature of the HP15c CE, I get 1.999870530 for the integral between 0 and 1 of 1/sqrt(x). Standard f FIX 4
Same for the third example - I got 1.772324417 in approx 1'30" |
|||
11-13-2023, 03:53 PM
Post: #4
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE | |||
11-13-2023, 04:23 PM
(This post was last modified: 11-13-2023 04:46 PM by J-F Garnier.)
Post: #5
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE
(11-13-2023 03:00 PM)Namir Wrote: intgeral of 1/sqrt(x) for x = 0 to 1 (accurate solution is 2) I'm 99.99999999% sure that the LE and CE give the same results, since they use the same ROM (except for the extended memory patches, if you use the CE/192 mode). You didn't mention an important condition to check your results, however I can give the result I got on the 15c HP emulator (2012) thanks to its fast speed and close simulation of the 15c LE : in FIX 7, first integral is 1.9999997 with an error bound of 0.0000001. This is indeed a case where the error estimation is inaccurate, still the result isn't that bad. BTW, it's a major benefit of the Romberg algorithm to provide an error bound. J-F |
|||
11-13-2023, 04:23 PM
Post: #6
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE
Namir, I find it both surprising and disturbing that the 15c LE and 15c CE are returning different results here, since in theory they should be running the same code.
Could you please post the exact steps you followed so we can verify that it's different between the two, especially since others are apparently not able to reproduce what you are seeing? |
|||
11-13-2023, 05:05 PM
Post: #7
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE
My TI-30X MathPrint gives 1.999999507 using an epsilon of 10^-06. Smaller epsilons produces tolerance not met error. My CASIO fx-991CW using bounds from 10^-18 to 1 produces an answer of 1.999999998. Using a lower bound of 10^-19, an error message of time out is generated.
|
|||
11-13-2023, 05:08 PM
Post: #8
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE
(11-13-2023 04:23 PM)Eric Rechlin Wrote: Namir, I find it both surprising and disturbing that the 15c LE and 15c CE are returning different results here, since in theory they should be running the same code. Don't get alarmed, Eric, it's probably a case of not using the exact same display setting (FIX n, SCI n, ENG n,) as the result of the integration absolutely depends on it. Just have the people use the exact same display settings and the various results will agree. It's just a matter of attention to detail. Best regards. V. All My Articles & other Materials here: Valentin Albillo's HP Collection |
|||
11-13-2023, 05:30 PM
(This post was last modified: 11-13-2023 05:58 PM by Namir.)
Post: #9
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE
Ok, I decided to retest using specific FIX modes and comparing. The LE and CE did produce the same results as expected. The CE seemed a bit slower in giving the results. When the FIX mode was between 2 and 3, thre results appeared quickly. FIX 4 took a few seconds more. The time for the integration seemed to me to rise exponentially.
The delya in obtaining a result also depends on the integrated function. Some functions are easier to integrate thhan others (within the context of improper integrals). intgeral of 1/sqrt(x) for x = 0 to 1 (exact is 2) HP-15 LE gave: 1.99 using FIX 2 1.999 using FIX 3 1.9999 using FIX 4 Using FIX 5 calculator kept flashing "running" for quiite a while! HP-15C CE gave: 1.99 using FIX 2 1.999 using FIX 3 1.9999 using FIX 4 (took a while) Using FIX 5 calculator kept flashing "running" for quiite a while! intgeral of cos(x)*log(x) for x = 0 to 1 (correct is -0.9460830703670) HP-15C LE gave: -0.94 using FIX 2 -0.946 using FIX 3 -0.9460 using FIX 4 -0.94608 using FIX 5 -0.946083 using FIX 6 -0.9460830 using FIX 7 -0.94608307 using FIX 8 HP-15C CE gave: -0.94 using FIX 2 -0.946 using FIX 3 -0.9460 using FIX 4 -0.94608 using FIX 5 -0.946083 using FIX 6 -0.9460830 using FIX 7 -0.94608307 using FIX 8 intgeral of 1/√(-Ln(x)) (correct is 1.77245385091) HP-15C LE gave: 1.76 using FIX 2 1.771 using FIX 3 1.7723 usin FIX 4 Using FIX 5 calculator kept flashing "running" for quiite a while! HP-15C CE gave: 1.76 using FIX 2 1.771 using FIX 3 1.7723 usin FIX 4 Using FIX 5 calculator kept flashing "running" for quiite a while! |
|||
11-13-2023, 06:01 PM
Post: #10
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE
Gents, it depend on how you write your program. Different ways of programming in the equations give alternate results.
|
|||
11-13-2023, 06:22 PM
Post: #11
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE
The following article by William Kahan from the Aug 1980 edition of HP Journal magazine may be relevant to this discussion. The calculator discussed was the HP-34C but I suspect the information pertains to the HP-15C as well.
Handheld Calculator Evaluates Integrals |
|||
11-13-2023, 07:57 PM
(This post was last modified: 11-13-2023 08:05 PM by Namir.)
Post: #12
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE | |||
11-13-2023, 08:26 PM
Post: #13
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE
(11-13-2023 07:57 PM)Namir Wrote:(11-13-2023 06:01 PM)Commie Wrote: Gents, it depend on how you write your program. Different ways of programming in the equations give alternate results. Yes sure, first choose a label then key in: 1(one) sqrt(x) /(divide) rtn(return) Then run the integral function between 0 and 1 Answer should give 2 in a matter of seconds. Cheers and I hope this helps |
|||
11-13-2023, 09:02 PM
(This post was last modified: 11-13-2023 09:17 PM by Johnh.)
Post: #14
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE
(11-13-2023 06:22 PM)Steve Simpkin Wrote: The following article by William Kahan from the Aug 1980 edition of HP Journal magazine may be relevant to this discussion. The calculator discussed was the HP-34C but I suspect the information pertains to the HP-15C as well. Thanks for linking that article by Prof. Kahan. I'm not a mathematician but that was one of the clearest and most candidly-written pieces that I've ever read on a mathematical topic. |
|||
11-13-2023, 11:19 PM
(This post was last modified: 11-14-2023 02:14 AM by Namir.)
Post: #15
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE
(11-13-2023 08:26 PM)Commie Wrote:(11-13-2023 07:57 PM)Namir Wrote: An example please? This is all new to me! Your code gives 0.5, because I believe you need to insert X<>Y between 1 and sqrt(x). In FIX 2 the modified program gives 1.99. In Fix 3, the modified program gives 1.999, and so on. The code I used is one step shorter: Code:
|
|||
11-14-2023, 07:27 AM
(This post was last modified: 11-14-2023 07:35 AM by Johnh.)
Post: #16
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE
I tried the 1 / (sqrt x) integral on my 15C CE, and a couple of 15C emulators, with very variable results!
The real 15C CE performed the same as described above, as each FIX setting, basically 1.999.....etc But two versions of Touch 15i for Android returned 2.012658, consistently subject to the number of digits requested, and never got nearer to 2. The Jovial JRPN 15C doesn't seem to settle on a value, even at just 2 or 3 decimal places |
|||
11-14-2023, 08:01 AM
Post: #17
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE
(11-14-2023 07:27 AM)Johnh Wrote: I tried the 1 / (sqrt x) integral on my 15C CE, and a couple of 15C emulators, with very variable results! I did try using HP-15C emulators with similar results.. I suspet the developers implement their preferred algorithms for numerical integration. It all comes down on how the algorithm handles the end points. The Gaussian Quadratures and Open Newton-Cotes methods do not evaluate the end points. I even tested the Trapezoidal mid-point algorithm and got goood approximations (for four decimal places) but at a whopping number of iterations! |
|||
11-14-2023, 02:16 PM
Post: #18
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE
(11-13-2023 11:19 PM)Namir Wrote: Your code gives 0.5, because I believe you need to insert X<>Y between 1 and sqrt(x). In FIX 2 the modified program gives 1.99. In Fix 3, the modified program gives 1.999, and so on. No, my hp15c ce gives exactly 2.0000 instantaneously, using my code. Works without exchange x<>y. |
|||
11-14-2023, 03:09 PM
Post: #19
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE
(11-13-2023 08:26 PM)Commie Wrote: Yes sure, first choose a label then key in: That defines the function x/(sqrt(1)), which is just x. You can just use RTN then. If you integrate that from 0 to 2 (not 1), you indeed get 2 right away, of course. Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
11-14-2023, 03:56 PM
Post: #20
|
|||
|
|||
RE: Improper Integrals with the HP-15C LE & CE
(11-14-2023 03:09 PM)Werner Wrote:(11-13-2023 08:26 PM)Commie Wrote: Yes sure, first choose a label then key in: The discussion is about the improper integral between 0 and 1. Commie's code was in error. See my correction in the message before yours. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 12 Guest(s)