(50g) Euler Transform

+- HP Forums (http://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (50g) Euler Transform (/thread-12610.html)



(50g) Euler Transform - John Keith - 03-12-2019 05:17 PM (This post was last modified: 08-07-2019 06:27 AM)

Following are programs for computing the Euler transform and its inverse for sequences of integers. Both require the ListExt Library. The inverse transform also requires Gerald Hillier's MOB program which computes the Moebius Mu function.

Euler transform:

Code:

\<< DUP SIZE R\->I \-> n
  \<< DUP HEAD SWAP 2 n
    FOR k k DIVIS DUP2 LPICK * LSUM SWAP
    NEXT DROP n \->LIST DUP 1. 1. SUB 2 n
    FOR j OVER 1 j 1 - SUB OVER REV * LSUM PICK3 j GET + j / +
    NEXT NIP
  \>>
\>>

Inverse Euler transform:

Code:

\<< DUP SIZE R\->I \-> n
  \<< DUP 1. 1. SUB 2 n
    FOR j OVER 1 j 1 - SUB OVER REV * LSUM PICK3 j GET j * SWAP - +
    NEXT NIP 1 n
    FOR k k DIVIS DUP2 LPICK SWAP REV MOB * LSUM k / SWAP
    NEXT DROP n \->LIST
  \>>
\>>