PDQ Algorithm: Infinite precision best fraction within tolerance
02-24-2019, 10:29 PM (This post was last modified: 02-24-2019 10:56 PM by cdmackay.)
Post: #21
 cdmackay Senior Member Posts: 739 Joined: Sep 2018
RE: PDQ Algorithm: Infinite precision best fraction within tolerance
(12-13-2013 05:09 AM)Joe Horn Wrote:  Examples (performed in CAS, not Home, for perfect accuracy):

• pdq(pi,14) --> $$\dfrac{47627751}{15160384}$$ (different, because pi is not equal to PI500).

(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

Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47
Casio, Rockwell 18R
02-25-2019, 11:10 AM
Post: #22
 Joe Horn Senior Member Posts: 2,005 Joined: Dec 2013
RE: PDQ Algorithm: Infinite precision best fraction within tolerance
(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.

but,
Example #2: pdq($$\pi$$,14) = $$\dfrac{111513555}{35495867}$$

Example #3: pdq($$\pi,\dfrac{13131}{10^{440}}$$) = $$\dfrac{27633741218861}{8796093022208}$$

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.

<0|ɸ|0>
-Joe-
02-25-2019, 05:56 PM
Post: #23
 cdmackay Senior Member Posts: 739 Joined: Sep 2018
RE: PDQ Algorithm: Infinite precision best fraction within tolerance
(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?

Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47
Casio, Rockwell 18R
02-26-2019, 03:17 AM
Post: #24
 Joe Horn Senior Member Posts: 2,005 Joined: Dec 2013
RE: PDQ Algorithm: Infinite precision best fraction within tolerance
(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).

<0|ɸ|0>
-Joe-
02-26-2019, 03:45 PM
Post: #25
 cdmackay Senior Member Posts: 739 Joined: Sep 2018
RE: PDQ Algorithm: Infinite precision best fraction within tolerance
(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!

Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47
Casio, Rockwell 18R
01-26-2020, 12:32 AM (This post was last modified: 01-26-2020 01:06 AM by cdmackay.)
Post: #26
 cdmackay Senior Member Posts: 739 Joined: Sep 2018
RE: PDQ Algorithm: Infinite precision best fraction within tolerance
(12-13-2013 05:09 AM)Joe Horn Wrote:  Here is a handy variable for PDQ experimentation.

PI500 (This fraction's decimal expansion has the same first 500 decimal places as pi. Remove all carriage returns):
Code:
27530008686166622188536681168621832641085194972343166639705257535483379211746872​24521381642611856603178539596529812288248903337810098177795117288227409717155741​87957420619251445521692137166819636595557228499775776315464391353285480273592327​83581546654/87630739315324660697093180818659895483560383602191807997668834668010919518358106​20316848615678705592355956178010775004819317000458201135712222333217497308440528​56473605433480720429471645084774186874516644432633187107318767999674836818181677​0785368793

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…

Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47
Casio, Rockwell 18R
01-26-2020, 02:41 AM
Post: #27
 Joe Horn Senior Member Posts: 2,005 Joined: Dec 2013
RE: PDQ Algorithm: Infinite precision best fraction within tolerance
(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.

PI500 (This fraction's decimal expansion has the same first 500 decimal places as pi. Remove all carriage returns):
Code:
27530008686166622188536681168621832641085194972343166639705257535483379211746872​24521381642611856603178539596529812288248903337810098177795117288227409717155741​87957420619251445521692137166819636595557228499775776315464391353285480273592327​83581546654/87630739315324660697093180818659895483560383602191807997668834668010919518358106​20316848615678705592355956178010775004819317000458201135712222333217497308440528​56473605433480720429471645084774186874516644432633187107318767999674836818181677​0785368793

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…

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:=2753000868616662218853668116862183264108519497234316663970525753548337921​17468722452138164261185660317853959652981228824890333781009817779511728822740971​71557418795742061925144552169213716681963659555722849977577631546439135328548027​359232783581546654/87630739315324660697093180818659895483560383602191807997668834668010919518358106​20316848615678705592355956178010775004819317000458201135712222333217497308440528​56473605433480720429471645084774186874516644432633187107318767999674836818181677​0785368793

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.

<0|ɸ|0>
-Joe-
01-26-2020, 08:34 PM
Post: #28
 cdmackay Senior Member Posts: 739 Joined: Sep 2018
RE: PDQ Algorithm: Infinite precision best fraction within tolerance
(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

Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47
Casio, Rockwell 18R
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)