Post Reply 
Π day
03-15-2022, 07:55 PM
Post: #21
RE: π day
(03-15-2022 04:56 PM)robve Wrote:  So I am not sure if this is the best choice of parameterization for this particular alternating series.

I only used what I wrote in the linked post, which was copied verbatim from Valentin's article.
But I agree with you. This series is not slowly converging like this one.
Therefore it's probably not that easy to decide if any form of acceleration is worth the effort.
That's why I gave an alternative solution for the HP-42S.

(03-15-2022 12:35 AM)robve Wrote:  In addition, I observed that summing the terms in reverse order may sometimes improve accuracy.

That's the point of Wirth's exercise.

(03-15-2022 12:35 AM)robve Wrote:  That's far more CPU power than the N=17 steps for the Sharp series to converge to 10 decimal places.

If you really care about CPU cycles you may want to avoid the expensive \(3^n\) calculation which usually uses \(\log\) and \(\exp\) under the hood.
For integer exponents this can be done more efficiently.
But I don't know if that is used by your Sharp calculator.

This can be achieved by rearranging the series like so:

\(
\begin{align}
1-{\frac {1}{3\cdot 3}}+{\frac {1}{5\cdot 3^{2}}}-{\frac {1}{7\cdot 3^{3}}}+\cdots =
1 - \frac{\frac{1}{3}-\frac{\frac{1}{5}-\frac{\frac{1}{7}-\frac{\frac{1}{9}-\cdots}{3}}{3}}{3}}{3}
\end{align}
\)

The calculation starts from inside out or rather top down like this:
Code:
def madhava(n):
    k = 2 * n + 1
    s = 0
    while k > 0:
        s = 1 / k - s / 3
        k -= 2
    return s

Cheers
Thomas


Quote:"I can count on my friends"
Is this count your friend?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Π day - robve - 03-14-2022, 03:35 AM
RE: Π day - Dave Britten - 03-14-2022, 11:44 AM
RE: Π day - Gerson W. Barbosa - 03-14-2022, 12:25 PM
RE: Π day - robve - 03-14-2022, 05:52 PM
RE: Π day - Dave Britten - 03-14-2022, 06:15 PM
RE: Π day - Gerson W. Barbosa - 03-14-2022, 11:53 AM
RE: Π day - EdS2 - 03-14-2022, 01:55 PM
RE: Π day - Gerson W. Barbosa - 03-14-2022, 06:06 PM
RE: Π day - EdS2 - 03-15-2022, 12:05 PM
RE: Π day - robve - 03-14-2022, 09:35 PM
RE: Π day - Gerson W. Barbosa - 03-14-2022, 10:30 PM
RE: Π day - robve - 03-14-2022, 02:10 PM
RE: Π day - Gerson W. Barbosa - 03-14-2022, 08:29 PM
RE: π day - Thomas Klemm - 03-14-2022, 09:17 PM
RE: Π day - robve - 03-15-2022, 04:56 PM
RE: Π day - ttw - 03-14-2022, 11:06 PM
RE: Π day - robve - 03-15-2022, 12:35 AM
RE: Π day - floppy - 04-02-2022, 11:12 AM
RE: Π day - Eddie W. Shore - 03-15-2022, 01:09 AM
RE: Π day - rprosperi - 03-15-2022, 12:25 PM
RE: Π day - Ren - 03-15-2022, 01:16 AM
RE: π day - Thomas Klemm - 03-15-2022 07:55 PM
RE: Π day - robve - 03-15-2022, 08:49 PM
RE: Π day - Thomas Klemm - 03-17-2022, 03:40 AM
RE: Π day - robve - 03-18-2022, 01:04 AM
RE: Π day - Thomas Klemm - 03-17-2022, 03:54 AM
RE: Π day - Gerson W. Barbosa - 03-17-2022, 11:39 AM
RE: Π day - Thomas Klemm - 03-17-2022, 12:29 PM
RE: Π day - Gerson W. Barbosa - 03-17-2022, 02:10 PM
RE: Π day - Ángel Martin - 03-18-2022, 09:07 AM
RE: Π day - Frido Bohn - 03-19-2022, 09:45 AM
RE: Π day - Ángel Martin - 03-19-2022, 11:17 AM
RE: Π day - Frido Bohn - 03-19-2022, 01:01 PM
RE: Π day - Frido Bohn - 03-19-2022, 03:13 PM
RE: Π day - DavidM - 03-17-2022, 08:25 PM
RE: Π day - Xorand - 03-18-2022, 03:06 AM
RE: Π day - Steve Simpkin - 03-18-2022, 04:31 AM
RE: Π day - MeindertKuipers - 03-18-2022, 10:48 AM
RE: Π day - Ángel Martin - 03-18-2022, 11:04 AM
RE: Π day - Ángel Martin - 03-19-2022, 11:18 AM
RE: Π day - Ren - 04-02-2022, 03:14 AM
RE: Π day - Ángel Martin - 03-20-2022, 07:39 AM
RE: Π day - Frido Bohn - 03-20-2022, 07:28 PM
RE: π day - Thomas Klemm - 03-21-2022, 07:24 AM
RE: Π day - Frido Bohn - 03-21-2022, 04:03 PM
RE: Π day - Albert Chan - 03-21-2022, 10:45 PM
RE: Π day - Gerson W. Barbosa - 03-24-2022, 01:36 AM
RE: Π day - Albert Chan - 03-26-2022, 03:59 PM
RE: Π day - Gerson W. Barbosa - 03-26-2022, 05:37 PM
RE: Π day - Thomas Klemm - 03-21-2022, 05:27 PM
RE: π day - Thomas Klemm - 03-21-2022, 05:54 PM
RE: π day - Thomas Klemm - 03-21-2022, 06:33 PM
RE: Π day - Albert Chan - 03-26-2022, 11:24 PM
RE: Π day - Albert Chan - 03-27-2022, 01:44 PM
RE: Π day - Albert Chan - 03-27-2022, 04:00 PM
RE: Π day - ttw - 03-31-2022, 02:04 AM



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