HP 15C and INT(1/√(1-x),0,1) - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: HP 15C and INT(1/√(1-x),0,1) (/thread-9577.html) |
RE: HP 15C and INT(1/√(1-x),0,1) - Carsen - 01-13-2018 01:35 AM (01-12-2018 10:57 AM)Dieter Wrote:(11-27-2017 01:33 AM)Carsen Wrote: Then I set the 15C to a fix of 4 and attempted to integrate the integral again. In a time of 16 minutes and 28 seconds, I stopped the 15C and didn't get an answer as a result. Is that so? I guess I'll have to pilfer my Dad's HP-15C and Handbook for a few days and break open my calculus book and notes. There are a lot of techniques I do not know about regarding the HP-15C but I fully intend to eventually. The Voyager Series is so elegant and perfect (close to perfect, that is). RE: HP 15C and INT(1/√(1-x),0,1) - Didier Lachieze - 01-14-2018 09:37 AM (01-14-2018 09:20 AM)Mike (Stgt) Wrote: So the clock frequency range is named as difference. Still looking for the values. From Craig Finseth hp-15c page : Code: The clock speed is about 220kHz and on the HP-41 is about 340kHz (60% faster). RE: HP 15C and INT(1/√(1-x),0,1) - grsbanks - 01-14-2018 10:30 AM (01-12-2018 04:18 AM)JimP Wrote: I tried the DM15 (SwissMicros) with FIX2 and received the 1.99 answer within 30 seconds -- clearly faster. Then thought I'd try to split the difference between your tests with FIX3. The machine shut down before it could give an answer, 5 minutes later... Are you sure the battery isn't just dead on your DM15? I ran that same test on mine and got the answer of 1.99 (FIX 2) in 8 seconds, 1.999 (FIX 3) in 61s and 1.9999 (FIX 4) in 478s. This is on a DM15L (exactly the same electronics and firmware as a DM15) on firmware V24 running at 48MHz. There is no real advantage to running the calculator at 12MHz because, while the drain on the battery may be slower at a lower frequency, it takes longer to get things done anyway so you're no better off energy-wise at the end of the day. RE: HP 15C and INT(1/√(1-x),0,1) - Didier Lachieze - 01-17-2018 05:06 AM From the HP-41C service manual, page 2-1: Code: The nominal oscillator frequency of 1440 kHz is reduced by And from the 1LF5-0301/1LF5-002 CPU detailed description, page 3-4: Code: The 1LE3 CPU is designed for 41C and 11C, 12C calculator. Both documents are available on TOS. RE: HP 15C and INT(1/√(1-x),0,1) - Didier Lachieze - 01-17-2018 01:12 PM (01-17-2018 12:03 PM)Mike (Stgt) Wrote: Hmm... what makes me uncertain about the MCode instruction count shown by my 'firmware interpreter'. Why? For the Voyagers this is up to ~3950 MCode instructions per second, knowing that between key press the CPU goes to sleep. RE: HP 15C and INT(1/√(1-x),0,1) - Dieter - 01-17-2018 07:07 PM (01-17-2018 05:41 PM)Mike (Stgt) Wrote: Why? -- I ran the 8-Queens programs for the HP41 and HP15C you find in here on a 'firmware interpreter' to count the MCode instructions (not the user program steps). When - for the HP15C - I find 18,210,956 MCode instructions and divide it by the ~3950 MCode instructions per second you named I get 4,610 seconds or 1 hr and ~17 min what is within 2 minutes of the value shown in the a. m. link. The numbers seem plausible, but this does not neccessarily mean that the calculation is correct. ;-) I still wonder if the 15C really is that slow. Compare it to the 34C: the two given programs are virtually identical (the 15C version even requires one step less) but the 15C is slighty slower. The 34C was my first HP calculator, so I know that it is not very fast and slower than the HP67. But is the 15C really even slower? Maybe someone with a physical (and original) 15C can try the program listed on the linked webpage and see if it really takes almost 80 minutes to finish. Dieter RE: HP 15C and INT(1/√(1-x),0,1) - TheKaneB - 01-17-2018 08:49 PM I have a 15C, original made in USA. I can do the test for you, if you can post the link with the code again, since I'm lost in all the replies and I am not sure where to look! RE: HP 15C and INT(1/√(1-x),0,1) - Dieter - 01-17-2018 09:22 PM (01-17-2018 08:49 PM)TheKaneB Wrote: I have a 15C, original made in USA. I can do the test for you, if you can post the link with the code again, since I'm lost in all the replies and I am not sure where to look! Here you are: 8-queens benchmark in the original Articles Forum. Simply do a browser search for "15C" there and find the program about halfway down the page, where it says HP-15C HP-15C LE DM-15 ----------- The following program is supposed to run in about 80 minutes on a regular 15C. Dieter RE: HP 15C and INT(1/√(1-x),0,1) - TheKaneB - 01-17-2018 09:38 PM Ok, I have the calculator running. We'll see how it goes RE: HP 15C and INT(1/√(1-x),0,1) - TheKaneB - 01-17-2018 10:35 PM EDIT: 1h 18m 45s ( +/- 1 s) While we're waiting for the result (still running) I should mention that the code for the 15C of that benchmark is very bad. It doesn't take advantage of the built in looping instructions (ISG and DSE), while the 41C version does. So the two times are not comparable. I think we should rewrite the code with some optimization. I bet we can make it much faster than that HP 15C code Code:
HP 41C code Code:
RE: HP 15C and INT(1/√(1-x),0,1) - TheKaneB - 01-18-2018 12:22 AM No, I didn't care to optimize it, it was just food for thought 24 seconds in 79 minutes is VERY underwhelming though... RE: HP 15C and INT(1/√(1-x),0,1) - TheKaneB - 01-21-2018 03:57 PM Back to the original topic: I used a C implementation of the Romberg algorithm to find the integral of f(x) = 1 / sqrt(1 - x) over the interval 0 - 1 It runs for a relatively long time (several seconds on my 3 GHz Intel i5) and it came up with this result: result = 2.000052194143781214563660 function evaluations = 1073741825 (1 billion of function evaluations!) I set an accuracy of 0.0001 with max steps = 100. I also used the interval from 0 to 0.99999999999 or else it would evaluate to NAN. If i set an accuracy of 0.01 I get this: result = 2.005444550190635499831160 function evaluations = 16777217 Code:
The code source is from wikipedia: https://en.wikipedia.org/wiki/Romberg%27s_method RE: HP 15C and INT(1/√(1-x),0,1) - Thomas Okken - 01-21-2018 04:46 PM (01-21-2018 03:57 PM)TheKaneB Wrote: I used a C implementation of the Romberg algorithm to find the integral of (I'm assuming the f(x) = 1 / sqrt(1 / x) is a typo?) There's room for improvement there. The Romberg implementation in Free42, based on code written by Hugh Steers, reaches those levels of accuracy with 32767 and 255 evaluations, respectively. I used ACC = 0.000025 and 0.0025, respectively, since Free42 treats ACC as a relative error, and using 0.0001 and 0.01 produce results that are less accurate than your examples. RE: HP 15C and INT(1/√(1-x),0,1) - TheKaneB - 01-21-2018 05:11 PM yes that was a typo, see the code for reference. RE: HP 15C and INT(1/√(1-x),0,1) - Thomas Klemm - 07-20-2018 01:04 PM The HP-15C ADVANCED FUNCTIONS HANDBOOK has on page 47 a section about: Transformation of Variables Quote:In many problems where the function changes very slowly over most of a very wide interval of integration, a suitable transformation of variables may decrease the time required to calculate the integral. You can use \(x=1-t^2\) which leads to: \[ \begin{eqnarray} dx&=&-2t\cdot dt \\ \sqrt{1-x}&=&t \\ \int_0^1\frac{1}{\sqrt{1-x}}dx&=&\int_1^0\frac{-2t}{t}dt \\ &=&2\int_0^1dt \\ &=&2t\bigg\vert_0^1 \\ &=&2-0=2 \end{eqnarray} \] Or then use \(x=\cos^2(t)\) which leads to: \[ \begin{eqnarray} \\ dx&=&-2\cos(t)\sin(t)dt \\ \sqrt{1-x}&=&\sin(t) \\ \int_0^1\frac{1}{\sqrt{1-x}}dx&=&\int_{\frac{\pi}{2}}^0\frac{-2\cos(t)\sin(t)}{\sin(t)}dt \\ &=&2\int_0^{\frac{\pi}{2}}\cos(t)dt \\ &=&2\sin(t)\bigg\vert_0^{\frac{\pi}{2}} \\ &=&2-0=2 \end{eqnarray} \] In both cases the resulting function can be integrated without problems. It's just a coincidence that both integrals can also be calculated easily algebraically. Cheers Thomas |