Musings on the HP-70 - 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: Musings on the HP-70 (/thread-21072.html) Musings on the HP-70 - Thomas Klemm - 12-29-2023 10:35 AM Fibonacci Sequence Initialisation DSP 0 CLR STO M 1 Loop M+ x<>y Result 0. 1. 1. 2. 3. 5. 8. 13. 21. 34. Explanation \begin{aligned} x_{0} &= 0 \\ x_{1} &= 1 \\ \\ x_{n+1} &= x_{n} + x_{n-1} \\ \end{aligned} Python Program Code: a, b = 0, 1 for k in range(10):     print(a)     a, b = b, a + b References Viète's formula for $$\pi$$ Initialisation DSP 9 0.5 STO K CLR STO M 2 ENTER ENTER ENTER Loop x<>y M+ K yx STO M ÷ × Result 2.000000000 2.828427125 3.061467459 3.121445152 3.136548491 3.140331157 3.141277251 3.141513801 3.141572940 3.141587725 3.141591422 3.141592346 3.141592577 3.141592634 3.141592649 3.141592652 3.141592653 3.141592654 3.141592654 Explanation $$\pi = 2 \cdot \frac{2}{\sqrt{2}} \cdot \frac{2}{\sqrt{2 + \sqrt{2}}} \cdot \frac{2}{\sqrt{2 + \sqrt{2 + \sqrt{2}}}} \cdots$$ Python Program Code: from math import sqrt p, q = 2, 0 for k in range(20):     print(f"{p:>.9f}")     q = sqrt(2 + q)     p *= 2 / q References Can you guess the result? Can you come up with other interesting recipes? RE: Musings on the HP-70 - Thomas Klemm - 12-29-2023 12:53 PM Here's another one: Euler's number Initialisation DSP 9 -1 STO K 13 STO M 1 ENTER ENTER ENTER Loop K M+ ÷ + Result 1.000000000 1.083333333 1.098484848 1.109848485 1.123316498 1.140414562 1.162916366 1.193819394 1.238763879 1.309690970 1.436563657 1.718281828 2.718281828 Explanation \begin{aligned} e &= 1+{\frac {1}{1}}+{\frac {1}{1\cdot 2}}+{\frac {1}{1\cdot 2\cdot 3}}+\cdots \\ &= 1 + \frac{1}{1}\left(1 + \frac{1}{2}\left(1 + \frac{1}{3}\left(1 + \cdots \right) \right) \right) \\ \end{aligned} Python Program Code: s = 0 for k in range(13, 0, -1):     s = 1 + s / k     print(f"{s:>.9f}") References I hope you realise in time when you have to stop. RE: Musings on the HP-70 - Thomas Klemm - 12-30-2023 09:02 AM Natural Logarithm Example $$\log(1.2) = \log(1 + 0.2) \approx 0.182321557$$ Initialisation DSP 9 -1 STO K 0.2 ENTER ENTER ENTER 11 STO M ÷ Loop 1 K M+ ÷ x<>y - × Result 0.018181818 0.016363636 0.018949495 0.021210101 0.024329408 0.028467452 0.034306510 0.043138698 0.058038927 0.088392215 0.182321557 Explanation \begin{aligned} \log(1+x) &= x-{\frac {x^{2}}{2}}+{\frac {x^{3}}{3}} - \cdots \\ &= x \cdot \left(\frac{1}{1} - x \cdot \left(\frac{1}{2} - x \cdot \left(\frac{1}{3} - \cdots \right) \right) \right) \end{aligned} Python Program Code: x = 0.2 s = 0 for k in range(11, 0, -1):     s = x * (1 / k - s)     print(f"{s:>.9f}") References