Post Reply 
[VA] SRC #016 - Pi Day 2024 Special
03-14-2024, 06:20 PM
Post: #1
[VA] SRC #016 - Pi Day 2024 Special
      
Hi, all,
     
Once again, today it's March, 14 aka \(\pi\) Day, so
 
Happy \(\pi\) Day 2024 and Welcome to SRC #16 - Pi Day 2024 Special

As always, this SRC #16 is intended to commemorate this super-ubiquitous constant, \(\pi\). I've been posting a number of threads over the years about \(\pi\) Day, these are the four previous ones: This time I'm featuring a potpourri of \(\pi\) appearances, most of them rare and/or unexpected for your visual and mathematical enjoyment once you've created and run the (mostly very simple) pertinent code on your favorite vintage calculator, preferably an HP model.

In due time I'll post my original code for the HP-71B and/or HP-42S/Free42, once you've had the opportunity to work on them for a few days. Oh, and sorry, no cake this time, we've ran out of cake !  Smile
    Note: No hard rules, post here whatever you want as long as it's on topic and NO CODE PANELS, but I'd appreciate it if you'd use vintage HP calcs (physical/virtual,) otherwise I might consider you kinda clueless as far as programming vintage HP calcs is concerned.

1. First appearance

First of all:  what do I consider a rare \(\pi\) appearance ? Well, broadly speaking mostly any unexpected appearances of \(\pi\) having nothing to do with circles or other geometric matters (including arc lengths, areas, volumes, etc.,) such as e.g. the one shown by this 2-line, 69-byte HP-71B program:

      1  DESTROY ALL @ RANDOMIZE 260 @ FIX 4 @ INPUT K
      2  N=0 @ FOR I=1 TO K @ N=N-MOD(IROUND(RND/RND),2) @ NEXT I @ DISP 1-4*N/K


      >RUN


              ? 1E5   ->  3.1416

That said. let's begin with the first appearance:

Solve this equation for x in [1, 6]. Post both result and code or keystroke sequence.

      [Image: pI%2003.jpg]

2. Second appearance

You can get a nice approximation to the value of \(\pi\) (exact as the number of tries goes to infinity) by following these simple steps. First set Count to zero and select a number of tries N, then:
    1. Choose two random integers A and B in [1, N].

    2. Check if they are co-prime, i.e. they have no common factors, in which case increment Count.

    Keep on performing steps 1 and 2 for N tries, then:

    3. Output [Image: SRC-13-1-1-tuorjj.jpg]

Post both code and results. My original solution is a 3-line, 102-byte HP-71B program which outputs the resulting values for N=10, 100, 1000, ..., one million tries.

3. Third appearance

Solve this equation for x, where \(\phi\) is the Golden Ratio = (1+√5)/2. Post both result and code or keystroke sequence:

     [Image: Pi%20phi%20b.jpg]

My original solution is a 2-line, 91-byte HP-71B program which outputs the resulting values of x for 10, 100, 1000, ..., 100,000 terms in the infinite product, and also a 2-line command line sequence which solves for x by using 100,000 terms straight away.

4. Fourth appearances

Although \(\pi\) can't appear in its entirety within an irrational algebraic number (because \(\pi\) is transcendental and thus not the root of a non-zero polynomial of finite degree with rational coefficients,) \(\pi\)'s prefixes of any length (first N digits of \(\pi\) for finite N) do actually appear inside irrational numbers, square roots for instance, like these:
    ● The 7-long prefix 3141592 appears in:

         3485  =  59.033888...4733453141592349004..  at decimal 822
         26401 = 162.483845...1905663141592268465..  at decimal  69
         82777 = 287.709923...3523123141592695866..  at decimal  45
       (8-long, actually !)
       
    ● The 10-long (rounded) prefix 3141592654 appears in:

         2424609  = 1557.115602...6896933141592654600235..  at decimal 170
         40850970 = 6391.476355...4838773141592654698929..  at decimal 112
See if you can find other appearances of assorted \(\pi\)'s prefixes in various irrationals (not necessarily square roots, logs or trigs would do too.) The smaller the argument and the earlier the appearance, the better. Post your best findings here (and yes, you can use whatever hardware/software, posting code's not mandatory.)

5. Fifth appearances

As stated above, \(\pi\) can't be a root of polynomial equations with rational coefficients but that doesn't prevent \(\pi\)'s prefixes of arbitrary finite length from appearing as roots of particular equations, e.g.:

Solve the following equations, either using a program or directly from the keyboard. Remember, don't post just the result, include also the code or keystroke sequence:
  • Polynomial equations:

          4 x3 - 22 x2 + 29 x + 2 = 0

          9 x4 - 19 x3 + 28 x2 - 70 x - 344 = 0
          
    See if you can find similar polynomial equations with roots even closer to \(\pi\). The smaller the degree and the size of the coefficients, the better.
          
  • Fermat-like:

          2063x + 8093x = 8128x

          1198x + 4628x = 4649x
          
  • Transcendental equation (where Γ is the Gamma function):

           Γ ln(7 x5/19) = 16
      
6. Sixth appearance

Given the following recurrence, with x0 = 0 and { } denoting the fractional part function,

      [Image: Pi%20recurrence.jpg]

write a program to compute its succesive terms x1, x2, x3, .. and for each term output in hexadecimal the value of

      dn = IP(16 xn )    ,   where IP is the integer part function,

then manually check whether each dn matches the nth hexadecimal digit of \(\pi\)'s fractional part, and if they do then maybe, just maybe, this recurrence quite unexpectedly produces \(\pi\)'s hex digits one at a time, as do spigot algorithms !

For example, the first 50 hex digits of \(\pi\)'s fractional part are

      3.243F6A8885 A308D31319 8A2E037073 44A4093822 299F31D008

so your program should output:  2  4  3  F  6  A  8  8  8 ..

Try and output as many correct hex digits as possible, which will depend on your model's range (10-digit, 12-digit, ..) and/or whether your code uses/implements multiprecision arithmetic or not.

My original solution consists of a 3-line, 112-byte HP-71B program which correctly produces the first 9 hex digits above, and a 49-step, 89-byte HP-42S program which when run on Free42 Decimal produces the first 26 correct hex digits.

7. Seventh appearance

Let x be the only real root of

      x3 - 6 x2 + 4 x - 2 = 0

Compute ln(x24 - 24) ÷ H, where H is the number of hours in a week minus five.

My original solution is a one-line command-line BASIC expression for the HP-71B as well as a 15-step, 28-byte RPN Solver program for the HP-42S or Free42.



Well, that's all for now.

If I see interest, I'll post in a few days my original solutions, including results, code (or keystroke sequences) and relevant comments.

My code is for the HP-71B and/or the HP-42S/Free42 but you might consider posting RPN, RPL, SysRPL or 71FORTH/Assembler code as well.

V.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[VA] SRC #016 - Pi Day 2024 Special - Valentin Albillo - 03-14-2024 06:20 PM



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