Post Reply 
(42S) Polynomial Operations
01-12-2019, 06:48 AM
Post: #5
RE: (42S) Polynomial Operations
(01-11-2019 03:51 PM)Albert Chan Wrote:  Is the code basically synthetic divisions, applied 3 times ?

I'd rather say it's Horner's method applied in parallel:

\(\begin{matrix}
2 & -1 & 5 & 7 \\
2 & -7 & 26 & -71 \\
0 & 2 & -13 & 65 \\
0 & 0 & 2 & -19
\end{matrix}\)

Here are the stack diagrams of the relevant lines of code:
Code:
09▸LBL 03               ;   2   2   0   0    ;   -1  -7  2   0     ;   5   26  -13 2
10 R↓                   ;   2   0   0   2    ;   -7  2   0   -1    ;   26  -13 2   5
11 X<> ST Z             ;   0   0   2   2    ;   0   2   -7  -1    ;   2   -13 26  5
12 LASTX                ;   -3  0   0   2    ;   -3  0   2   -7    ;   -3  2   -13 26
13 ×                    ;   0   0   2   2    ;   0   2   -7  -7    ;   -6  -13 26  26
14 X<>Y                 ;   0   0   2   2    ;   2   0   -7  -7    ;   -13 -6  26  26
15 STO+ ST Y            ;   0   0   2   2    ;   2   2   -7  -7    ;   -13 -19 26  26
16 LASTX                ;   -3  0   0   2    ;   -3  2   2   -7    ;   -3  -13 -19 26
17 ×                    ;   0   0   2   2    ;   -6  2   -7  -7    ;   39  -19 26  26
18 R↑                   ;   2   0   0   2    ;   -7  -6  2   -7    ;   26  39  -19 26
19 STO+ ST Y            ;   2   2   0   2    ;   -7  -13 2   -7    ;   26  65  -19 26
20 LASTX                ;   -3  2   2   0    ;   -3  -7  -13 2     ;   -3  26  65  -19
21 ×                    ;   -6  2   0   0    ;   21  -13 2   2     ;   -78 65  -19 -19
22 RCLEL                ;   -1  -6  2   0    ;   5   21  -13 2     ;   7   -78 65  -19
23 STO+ ST Y            ;   -1  -7  2   0    ;   5   26  -13 2     ;   7   -71 65  -19

According to hp42s:
Quote:77 matrix wrap, first to last

This is a marvel of stackrobatics. Thanks for sharing.

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (42S) Polynomial Operations - Werner - 01-11-2019, 01:37 PM
RE: (42S) Polynomial Operations - Dieter - 01-12-2019, 08:41 AM
RE: (42S) Polynomial Operations - Thomas Klemm - 01-12-2019 06:48 AM



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