PDQ Algorithm: Infinite precision best fraction within tolerance - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: HP Prime Software Library (/forum-15.html) +--- Thread: PDQ Algorithm: Infinite precision best fraction within tolerance (/thread-61.html) Pages: 1 2 |
RE: PDQ Algorithm: Infinite precision best fraction within tolerance - cdmackay - 02-24-2019 10:29 PM (12-13-2013 05:09 AM)Joe Horn Wrote: Examples (performed in CAS, not Home, for perfect accuracy): (02-24-2019 08:36 PM)smartin Wrote: Example #2: pdq(\(\pi\),14) = \(\dfrac{111513555}{35495867}\) I get pdq(\(\pi\),14) = \(\dfrac{47627751}{15160384}\), on the Android emulator (2.1.14181) in both Home & CAS, using the code that I copied and pasted directly into the program editor, from the first post in this thread. edit: I get the same on my Prime G2, and also the MacOS virtual Prime (both same firmware as above) using the hpprgm files downloaded from hpcalc. shouldn't be relevant, but: Number Format: Standard, 12 epsilon: 1e-12 RE: PDQ Algorithm: Infinite precision best fraction within tolerance - Joe Horn - 02-25-2019 11:10 AM (02-24-2019 08:36 PM)smartin Wrote: Finally inspired to try out PDQ on the Prime, but I could not get all the examples to work out. I'm using PDQ from hpcalc.org (https://www.hpcalc.org/details/7477) on a Prime with CAS ver 1.4.9 and ROM 2.1.14181. That's because you are using the built-in pi, which is less accurate than the precision you're asking for. Instead of using the built-in pi, use PI500 as your input instead; it's accurate to 500 digits. PI500 is available in the original posting. RE: PDQ Algorithm: Infinite precision best fraction within tolerance - cdmackay - 02-25-2019 05:56 PM (02-25-2019 11:10 AM)Joe Horn Wrote: That's because you are using the built-in pi, which is less accurate than the precision you're asking for. Instead of using the built-in pi, use PI500 as your input instead; it's accurate to 500 digits. PI500 is available in the original posting. Joe, how is it that I get the same value as in your post, using the inbuilt pi, but smartin gets a different value using the same expression as me? RE: PDQ Algorithm: Infinite precision best fraction within tolerance - Joe Horn - 02-26-2019 03:17 AM (02-25-2019 05:56 PM)cdmackay Wrote: Joe, how is it that I get the same value as in your post, using the inbuilt pi, but smartin gets a different value using the same expression as me? Perhaps he accidentally keyed pdq(pi,15) instead of pdq(pi,14). That's just a guess, but it seems likely, since his result is the correct output for pdq(pi,15). RE: PDQ Algorithm: Infinite precision best fraction within tolerance - cdmackay - 02-26-2019 03:45 PM (02-26-2019 03:17 AM)Joe Horn Wrote: Perhaps he accidentally keyed pdq(pi,15) instead of pdq(pi,14). That's just a guess, but it seems likely, since his result is the correct output for pdq(pi,15). argh! RE: PDQ Algorithm: Infinite precision best fraction within tolerance - cdmackay - 01-26-2020 12:32 AM (12-13-2013 05:09 AM)Joe Horn Wrote: Here is a handy variable for PDQ experimentation. sorry, this is no doubt a silly question, but, how do I get the above useful variable into my physical calculator, without having to type it all in? I'd assumed that there must be some way of doing it with the Connectivity Kit, but after a lot of fiddling, I can't see how to do it. I tried pasting it into the virtual Prime app, and from there I can see it in that calculator's CAS Vars entry in the CK. But I can't see to get it from there into my physical Prime, nor into the "Content" area. thanks… RE: PDQ Algorithm: Infinite precision best fraction within tolerance - Joe Horn - 01-26-2020 02:41 AM (01-26-2020 12:32 AM)cdmackay Wrote:(12-13-2013 05:09 AM)Joe Horn Wrote: Here is a handy variable for PDQ experimentation. Although there must be a better way to do it than my way, here's how I do it. Create a text file on your PC called PI500.TXT which contains the following plain text (w/o carriage returns): Code: PI500:=27530008686166622188536681168621832641085194972343166639705257535483379211746872245213816426118566031785395965298122882489033378100981777951172882274097171557418795742061925144552169213716681963659555722849977577631546439135328548027359232783581546654/8763073931532466069709318081865989548356038360219180799766883466801091951835810620316848615678705592355956178010775004819317000458201135712222333217497308440528564736054334807204294716450847741868745166444326331871073187679996748368181816770785368793 Now create a blank Note on your Virtual Prime and/or your real Prime via the Connectivity Kit. Paste the above text file into that Note for safekeeping. Now paste it into CAS and evaluate it, which creates the desired CAS var. Any time the CAS var gets destroyed (which seems to happen to me annoyingly often) just copy that Note and paste it into CAS again. If the Note ever gets lost (happens very rarely), copy it again from PI500.TXT as before. Ridiculously complicated, but it's how I've been doing it for years. If anybody knows of a better way of creating & saving the above PI500 as a CAS var, please share it with us. RE: PDQ Algorithm: Infinite precision best fraction within tolerance - cdmackay - 01-26-2020 08:34 PM (01-26-2020 02:41 AM)Joe Horn Wrote: Although there must be a better way to do it than my way, here's how I do it. Perfect! thanks very much, Joe. Glad I wasn't missing anything obvious |