hp41programs

Bions

Bi-ons = Complexified Anions for the HP-41


Overview
 

 0°)  M-Code Routines
 1°)  Multiplication

  a)  General Case
  b)  Bi-ons with proportional imaginary parts ( focal program & M-code routine B*B1 )

 2°)  Miscellaneous Functions + 2 M-Code routines:  Z*B & Z*IMB
 3°)  Polynomials with complex coefficients
 4°)  Bionic Equations F(b) = b
 

-In "Anions for the HP-41", we have used the Cayley-Dickson formula

         ( a , b ) ( c , d ) = ( a c - d* b , d a + b c* )       where   * = conjugate

 to construct the complexes from the real numbers, regarding a complex as a pair of real numbers,
 and then the quaternions from the complexes, the octonions from the quaternions, the sedenions from the octonions,
 the 32-ons from the sedenions, the 64-ons from the 32-ons ... and so on ... for the 2^n-ons

-But if we start with the complexes, we gradually get the bi-complexes, bi-quaternions, bi-octonions, bi-sedenions ...

-The programs listed in this page calculate elementary functions of these "bi-ons"
 

0°)  M-Code Routines
 

-Unfortunately, I've not found a good way to avoid using M-code routines, especially to compute complex functions, namely:

  Z*Z  Z^2  SQRTZ  1/Z  Z/Z   Z+Z         cf "A few M-Code Routines for the HP-41"

and also  X+1   SINH   COSH                  -------------------------------------------

-Several M-Code routines that are useful for anions may also be employed for bi-ons:

  A+A  A-A  ST*A  ST/A  AMOVE  ASWAP   cf "Anions" and "Anionic Functions for the HP-41"

-Of course, you can use your own routines, provided  Z*Z  does not alter synthetic register Q
 

1°)  Multiplication
 

     a)  General Case
 

-This program employs the Cayley-Dickson formula recursively.
-Unfortunately, there are not enough registers for bi-64-ons.

-The 2n components of the 1st bion are to be sored into R01-R02 , R03-R04 , ............... , R2n-1-R2n   ( 2 real numbers for each bj )
-Likewise for the 2n components of the 2nd bion into  R2n+1-R2n+2 , ............................ , R4n-1-R4n   ( 2 real numbers for each b'j )

     b = b0 + b1 e1 + ............... + bn-1 en-1
    b' = b'0 + b'1 e1 + ............... + b'n-1 en-1

-"B*B" does not use any M-Code routine !
 

Data Registers:           •  R00 = 2n ( 4 , 8 , 16 , 32 or 64 )                  ( Registers R00 thru R4n are to be initialized before executing "B*B" )

                                      •  R01   ......  •  R2n = the components of the 1st bi-ion
                                      •  R2n+1 ....  •  R4n = the components of the 2nd bi-ion

  >>>  When the program stops:     R01   ......  R2n = the 2n components of the product

-During the calculations,

    R01 to R04 = bicomplex1    R09 to R16 = biquaternion1  R25 to R40 = bioctonion1  R57 to R88 = bisedenion1     R121 to R184 = bi-32-on1
    R05 to R08 = bicomplex2    R17 to R24 = biquaternion2  R41 to R56 = bioctonion2  R89 to R120 = bisedenion2   R185 to R248 = bi-32-on2

Flags: /
Subroutines:  /
 
 
 

  01  LBL "B*B"
  02  RCL 00
  03  ST+ X
  04  .1
  05  %
  06  +
  07  7
  08  -
  09   E3
  10  /
  11  1
  12  +
  13  REGMOVE
  14  XEQ 01
  15  RCL 00
  16   E3
  17  /
  18  ISG X
  19  STO Y
  20   E3
  21  /
  22  RCL 00
  23  ST+ X
  24  +
  25  7
  26  -
  27  REGMOVE
  28  X<>Y
  29  RTN
  30  LBL 01
  31  2
  32  ST/ 00
  33  RCL 00
  34  X#Y?
  35  GTO 02
  36  RCL 01
  37  RCL 05
  38  *
  39  RCL 02
  40  RCL 06
  41  *
  42  -
  43  RCL 03
  44  RCL 07
  45  *
  46  -
  47  RCL 04
  48  RCL 08
  49  *
  50  +
  51  STO M
  52  RCL 01
  53  RCL 06
  54  *
  55  RCL 02
  56  RCL 05
  57  *
  58  +
  59  RCL 03
  60  RCL 08
  61  *
  62  -
  63  RCL 04      
  64  RCL 07
  65  *
  66  -
  67  RCL 01
  68  RCL 07
  69  *
  70  RCL 02
  71  RCL 08
  72  *
  73  -
  74  RCL 03
  75  RCL 05
  76  *
  77  +
  78  RCL 04
  79  RCL 06
  80  *
  81  -
  82  X<> 03
  83  RCL 06
  84  *
  85  RCL 01
  86  RCL 08
  87  *
  88  +
  89  RCL 02
  90  RCL 07
  91  *
  92  +
  93  RCL 04
  94  RCL 05
  95  *
  96  +
  97  STO 04
  98  X<>Y
  99  STO 02
100  CLX
101  X<> M
102  STO 01
103  RCL 00
104  ST+ 00
105  RTN
106  LBL 02
107  RCL 00
108   E3
109  /
110  RCL 00
111  ST+ X
112  +
113  STO Y
114  7
115  -
116   E3
117  /
118  RCL 00
119  4
120  *
121  +
122  7
123  -
124  REGMOVE
125  +
126  REGMOVE
127  XEQ 01
128  RCL 00
129   E3
130  /
131  RCL 00
132  4
133  *
134  +
135  7
136  -
137   E3
138  /
139  RCL 00
140  ST+ X
141  +
142  7
143  -
144  REGSWAP
145  RCL 00
146   E3
147  /
148  -
149  REGMOVE
150  LASTX
151  -
152  RCL 00
153  5
154  *
155  +
156  REGMOVE
157  XEQ 01
158  RCL 00
159   E3
160  /
161  RCL 00
162  7
163  *
164  +
165  7
166  -
167   E3
168  /
169  RCL 00
170  ST+ X
171  +
172  7
173  -
174  ENTER^
175  REGSWAP
176  SIGN
177  ST+ Y
178  CHS
179  ST* IND L
180  ST* IND Y
181  LASTX
182  RCL 00
183  2.996
184  *
185  +
186  REGMOVE
187  XEQ 01
188  RCL 00
189  3
190  *
191  8
192  -
193  RCL 00
194  ST+ X
195  LASTX
196  -
197   E3
198  /
199  +
200  RCL 00
201  5
202  *
203  8
204  -
205  STO Z
206  ISG Z
207  LBL 03
208  RCL IND Y
209  ST+ IND Y
210  RDN
211  DSE X
212  DSE Y
213  GTO 03
214  X<> Z
215  RCL 00
216   E3
217  /
218  RCL 00
219  ST+ X
220  +
221  7
222  -
223   E3
224  /
225  +
226  REGMOVE
227  RCL 00
228  .1
229  %
230  +
231  +
232  REGMOVE
233  FRC
234   E3
235  *
236  ENTER^
237  SIGN
238  ST+ Y
239  CHS
240  ST* IND L
241  ST* IND Y
242  XEQ 01
243  RCL 00
244  3
245  *
246  8
247  -
248  RCL 00
249  ST+ X
250  LASTX
251  -
252   E3
253  /
254  +
255  RCL 00
256  8
257  ST* Y
258  -
259  LBL 04
260  RCL IND Y
261  ST- IND Y
262  RDN
263  DSE X
264  DSE Y
265  GTO 04
266  RCL 00
267   E3
268  /
269  RCL 00
270  5
271  *
272  +
273  7
274  -
275   E3
276  /
277  RCL 00
278  7
279  *
280  +
281  7
282  -
283  REGMOVE
284  RCL 00
285  ST+ 00
286  RTN
287  END

 
       ( 378 bytes / SIZE 8n-7 )
 
 

      STACK        INPUT      OUTPUT
           X             /          1.2n

   where  1.2n  is the control number of the result.

Example:   Find the product of the bisedenions:

  b = ( 25 + 108 i ) + ( 105 + 113 i ) e1 + ( 48 + 3 i ) e2 + ( 123 + 65 i ) e3 + ( 45 + 11 i ) e4 + ( 58 + 20 i ) e5 + ( 34 + 84 i ) e6 + ( 38 + 117 i ) e7
    + ( 81 + 46 i ) e8 + ( 52 + 36 i ) e9 + ( 35 + 125 i ) e10 + ( 16 + i ) e11 + ( 41 + 109 i ) e12 + ( 15 + 91 i ) e13 + ( 63 + 94 i ) e14 + ( 55 + 28 i ) e15

  b' = ( 100 + 39 i ) + ( 27 + 59 i ) e1 + ( 61 + 12 i ) e2 + ( 99 + 129 i ) e3 + ( 49 + 44 i ) e4 + ( 101 + 80 i ) e5 + ( 5 + 74 i ) e6 + ( 21 + 75 i ) e7
     + ( 62 + 53 i ) e8  + ( 77 + 13 i ) e9 + ( 9 + 107 i ) e10 + ( 64 + 4 i ) e11 + ( 33 + 43 i ) e12 + ( 60 + 102 i ) e13 + ( 121 + 114 i ) e14 + ( 89 + 112 i ) e15

-You can use the short routine below to store these coefficients into R01 thru R64
 
 

 01  1.064
 02  7
 03  LBL 01
 04  41 
 05  *
 06  131
 07  MOD
 08  STO IND Y
 09  ISG Y
 10  GTO 01
 11  RTN

 
-Bisedenions so n = 16 and 2n = 32  STO 00

-SIZE 121 at least

  XEQ "B*B"  >>>>  1.032             in about 6 minutes

-And we get   R01 = 22450  R02 = -93103  .......................  R31 = -14895  R32 = 36483

-Thus,

   b.b' = ( 22450 - 93103 i ) + ( -3665 + 12974 i ) e1 + ( 32291 - 31812 i ) e2 + ( 18482 + 29668 i ) e3 + ( -7840 + 8985 i ) e4 + ( 1001 + 48348 i ) e5
          + ( -10494 + 6090 i ) e6 + ( -1657 + 25709 i ) e7 + ( -14243 - 595 i ) e8  + ( 9295 + 1562 i ) e9 + ( -19125 + 35197 i ) e10 + ( 18449 - 20036 i ) e11
          + ( -3315 + 35478 i ) e12 + ( -22176 + 9676 i ) e13 + ( 11818 + 23190 i ) e14 + ( -14895 + 36483 i ) e15

Note:

-The product of 2 bi-32-ons should last about 24 minutes.
 

     b)  Bi-ons with proportional imaginary parts
 

-Fortunately, the formulas are much simpler if the 2 bi-ons have the same imaginary direction, I mean if, given  b & b'

     b = b0 + b1 e1 + ............... + bn-1 en-1
    b' = b'0 + b'1 e1 + ............... + b'n-1 en-1

  there exist a complex number c such that, for all  i > 0 ,  b'i = c bi  or  bi = c b'i

-The program hereunder is useful in this case, and it uses only 4n+1 registers
 

Data Registers:           •  R00 = 2n > 3                                   ( Registers R00 thru R4n are to be initialized before executing "B*B1" )

                                      •  R01   ......  •  R2n = the n components of the 1st bi-on
                                      •  R2n+1 ....  •  R4n = the n components of the 2nd bi-on

  >>>  When the program stops:     R01   ......  R2n = the n components of the product,   R2n+1  ........ R4n  are unchanged.

Flags: /
Subroutine:  Z*Z
 
 
 

 01  LBL "B*B1"
 02  RCL 00
 03  .002
 04  +
 05  STO M
 06  RCL 00
 07  2
 08  +
 09  RCL IND X
 10  DSE Y
 11  RCL IND Y
 12  RCL 02
 13  RCL 01
 14  Z*Z
 15  STO N
 16  X<>Y
 17  STO O
 18  LBL 01
 19  RCL IND M
 20  DSE M
 21  RCL IND M
 22  RCL 00
 23  2
 24  +
 25  SIGN
 26  CLX
 27  RCL IND L
 28  DSE L
 29  RCL IND L
 30  Z*Z
 31  STO P
 32  RDN
 33  STO Q
 34  CLX
 35  RCL M
 36  RCL 00
 37  +
 38  SIGN
 39  ST+ L
 40  CLX
 41  RCL IND L
 42  DSE L
 43  RCL IND L
 44  R^
 45  R^
 46  Z*Z
 47  ST- N
 48  RDN
 49  ST- O
 50  CLX
 51  RCL 02
 52  RCL 01
 53  Z*Z
 54  RCL P
 55  +
 56  STO IND M
 57  RCL M
 58  X+1
 59  RCL Z
 60  RCL Q
 61  +
 62  STO IND Y
 63  DSE M
 64  GTO 01
 65  RCL N
 66  STO 01
 67  RCL O
 68  STO 02
 69  RCL 00
 70   E3
 71  /
 72  ISG X
 73  CLA
 74  END

 
      ( 124 bytes / SIZE 4n+1 )
 
 

      STACK        INPUT      OUTPUT
           X             /          1.2n

   where  1.2n  is the control number of the product.

Example:   Find the product of the biquaternions

  b = ( 6 - 9 i ) + ( -4 + 2 i ) e1 + ( -3 + i ) e2 + ( -4 + 7 i ) e3                            here,   Im(b') = ( 2 + 3i ) Im(b)
  b' = ( 4 + 7 i ) + ( -14 - 8 i ) e1 + ( -9 - 7 i ) e2 + ( -29 + 2 i ) e3

-> biquaternions, so  8  STO 00

-Store the coefficients into R01 thru R16

    6  STO 01   -9  STO 02   -4  STO 03   2  STO 04  ..........................  -29  STO 15    2  STO 16

    XEQ "B*B1"  >>>>  1.008                 ---Execution time = 6 seconds---

  R01 = -121    R02 = 201
  R03 = -186    R04 =  58
  R05 = -136    R06 =  22
  R07 = -221    R08 = 273

-Thus,  b b' = ( -121 + 201 i ) + ( -186 + 58 i ) e1 + ( -136 + 22 i ) e2 + ( -221 + 273 i ) e3

Notes:

-"B*B1" does not check that the imaginary parts are proportional.
-This routine uses the synthetic registers M , N , O , P & Q
-Most of the "bionic" functions deal with such hypercomplexes and "B*B1" is sufficient.

-So, an M-code routine is quite useful and will be much faster:

Initialization

-This routine is alread listed in "Anions for the HP-41"
-Please take a look at this page for more details.
 

260  SETHEX                   @EFC8  in my ROM
378  C=c
03C  RCR 3
106  A=C S&X
130  LDI S&X
200  200h                           correct value for an HP-41CV/CX or an HP-41C with a QUAD memory module
306  ?A<C S&X
381  ?NCGO
00A  NEXIST
0A6  A<>C S&X
270   RAMSELECT
038   READATA
38D  ?NCXQ
008   N->S&X
2E6  ?C#0 S&X
0B5  ?NCGO
0A2  ERROR
05A  C=0 M
23A  C=C+1 M
106  A=C S&X
1BC  RCR 11
0A6  A<>C S&X
1E6  C=C+C S&X
10E  A=C ALL
378  C=c
03C  RCR 3
0E6  B<>C S&X
378  C=c
0C6  C=B S&X
1BC  RCR 11
0C6  C=B S&X
20E  C=A+C ALL
24C  ?FSET 9
013  JNC+02
03C  RCR 3
070  N=C ALL
10E  A=C ALL
130  LDI S&X
200  200h
306  ?A<C S&X
381  ?NCGO
00A  NEXIST
3E0  RTN                        @EFF2  in my ROM

  ( 43 words )
 

-To call this subroutine:    ?NCXQ  EFC8  =  321   3BC    in my ROM
-Change these 2 words if you have loaded this routine at another address...

Multiplication Routine:

- B*B1 below does the same calculations as "B*B1" above
 

0B1  "1"
002   "B"
02A  "*"
002   "B"
244   CLRF 9
321   ?NCXQ                   executes the initialization
3BC  EFC8                       routine above
378   C=c
03C  RCR 3
226   C=C+1 S&X
226   C=C+1 S&X
226   C=C+1 S&X
106   A=C S&X
0B0  C=N ALL
306   ?A<C S&X
0B5   ?NCGO
0A2   DATAERROR         There will be a DATA ERROR message if  R00 = 2n < 4
03C   RCR 3
106   A=C S&X
17C  RCR 6
0A6  A<>C S&X
226   C=C+1 S&X
226   C=C+1 S&X
0BC  RCR 5
070   N=C ALL
27C  RCR 9
10E  A=C ALL
270  RAMSLCT
038  READATA
0AE  A<>C ALL
266   C=C-1 S&X
270  RAMSLCT
038  READATA
0EE  B<>C ALL
046  C=0 S&X
270  RAMSLCT
0EE  B<>C ALL
068  Z=C
0AE A<>C ALL
028  T=C
0B0  C=N ALL
17C  RCR 6
270  RAMSLCT
038  READATA
10E  A=C ALL
0B0  C=N ALL
17C  RCR 6
226  C=C+1 S&X
270  RAMSLCT
038  READATA
0EE  B<>C ALL
046  C=0 S&X
270  RAMSLCT
0EE  B<>C ALL
0A8  Y=C
0AE  A<>C ALL
0E8  X=C
0B0  C=N ALL
268   Q=C
259   ?NCXQ            The 1st executable word of my Z*Z routine is @F696 in my ROM
3D8   Z*Z                  Change these 2 words according to your own ROM
0F8   C=X
168   M=C
0B8  C=Y                  Here, M and N are synthetic registers ( not CPU registers )
1A8  N=C
278  C=Q
070  N=C ALL
260  SETHEX
0B0  C=N ALL          LOOP    @FD79 in my ROM
03C  RCR 3
10E  A=C ALL
270  RAMSLCT
038  READATA
0AE  A<>C ALL
266  C=C-1 S&X
270  RAMSLCT
038  READATA
0EE  B<>C ALL
046  C=0 S&X
270  RAMSLCT
0EE  B<>C ALL
068  Z=C
0AE  A<>C ALL
028  T=C
0B0  C=N ALL
27C  RCR 9
10E  A=C ALL
270  RAMSLCT
038  READATA
0AE  A<>C ALL
266  C=C-1 S&X
270  RAMSLCT
038  READATA
0EE  B<>C ALL
046  C=0 S&X
270  RAMSLCT
0EE  B<>C ALL
0E8  X=C
0AE  A<>C ALL
0A8  Y=C
0B0  C=N ALL
268  Q=C
259   ?NCXQ            The 1st executable word of my Z*Z routine is @F696 in my ROM
3D8   Z*Z                  Change these 2 words according to your own ROM
0F8  C=X
1E8  O=C
0B8  C=Y
228   P=C
046  C
270  =
038  T
0A8  Y=C
078  C=Z
0E8  X=C
278  C=Q
070  N=C ALL
10E  A=C ALL
270  RAMSLCT
038  READATA
0AE  A<>C ALL
260  SETHEX
266  C=C-1 S&X
270  RAMSLCT
038  READATA
0EE  B<>C ALL
046  C=0 S&X
270  RAMSLCT
0EE  B<>C ALL
068  Z=C
0AE  A<>C ALL
028   T=C
259   ?NCXQ            The 1st executable word of my Z*Z routine is @F696 in my ROM
3D8   Z*Z                  Change these 2 words according to your own ROM
0F8  C=X
2BE  C=-C
10E  A=C ALL
178  C=M
01D  C=
060  A+C
168  M=C
0B8  C=Y
2BE  C=-C
10E  A=C ALL
1B8  C=N
01D  C=
060  A+C
1A8  N=C
278  C=Q
070  N=C ALL
17C  RCR 6
10E  A=C ALL
270  RAMSLCT
038  READATA
0AE A<>C ALL
260  SETHEX
226  C=C+1 S&X
270  RAMSLCT
038  READATA
0EE  B<>C ALL
046  C=0 S&X
270  RAMSLCT
0EE  B<>C ALL
0A8  Y=C
0AE  A<>C ALL
0E8  X=C
259   ?NCXQ            The 1st executable word of my Z*Z routine is @F696 in my ROM
3D8   Z*Z                  Change these 2 words according to your own ROM
0B8  C=Y
10E  A=C ALL
238  C=P
01D  C=
060  A+C
10E  A=C ALL
278  C=Q
03C  RCR 3
070  N=C ALL
270  RAMSLCT
0AE A<>C ALL
2F0  WRITDATA
046  C=0 S&X
270  RAMSLCT
0F8  C=X
10E  A=C ALL
1F8  C=O
01D  C=
060  A+C
10E  A=C ALL
0B0  C=N ALL
260  SETHEX
266  C=C-1 S&X
270  RAMSLCT
0AE  A<>C ALL
2F0  WRITDATA
0B0  C=N ALL
266  C=C-1 S&X
266  C=C-1 S&X
1BC  RCR 11
266  C=C-1 S&X
266  C=C-1 S&X
070  N=C ALL
106  A=C S&X
27C  RCR 9
226  C=C+1 S&X
306  ?A<C S&X
1E5   ?NCXQ              GOTO LOOP @FD79 in my ROM
3F6   FD79                  Change these 2 words according to your own ROM
046  C=0 S&X
270  RAMSLCT
1B8  C=N
10E  A=C ALL
178  C=M
0EE  B<>C ALL
0B0  C=N ALL
17C  RCR 6
270  RAMSLCT
0EE  B<>C ALL
2F0  WRITDATA
0EE  B<>C ALL
226  C=C+1 S&X
270  RAMSLCT
0AE A<>C ALL
2F0  WRITDATA
0B0  C=N ALL
17C  RCR 6
266  C=C-1 S&X
270  RAMSLCT
038  READATA
2A0  SETDEC
266  C=C-1 S&X
266  C=C-1 S&X
266  C=C-1 S&X
10E  A=C ALL
046  C=0 S&X
270  RAMSLCT
04E  C
35C  =
050   1
01D  C=
060  A+C
0E8  X=C
345  ?NCGO
042    CLA

( 242 words )
 
 

      STACK        INPUT      OUTPUT
           X             /          1.2n

   where  1.2n  is the control number of the product.
 

Note:

-The product of 2 bisedenions ( 2n = 32 ) is about 7 seconds
 

2°)  Miscellaneous Functions
 

-These programs compute elementary functions of a "bi-on":

    •  "1/B"    inverse

         B-1 = B* / | B |2    where B* is the conjugate of  B   and   | B |2 = b02 + b12 + ................. + bN-12

-Note that here  | B |  may equal 0 even if b # 0 since the components bj are complexes !
-So, b # 0 may not have an inverse !
 

    •  "E^B"   exponential

        exp( b0 + b1 e1 + .... + bN-1 bN-1 ) = eb0 [ cos µ + ( sin µ ). I ]

       where  µ = ( b12 + ............... + bN-12 )1/2    and    I = ( b1 e1 + ............. + bN-1 eN-1 ) / µ

   •   "LNB"  natural logarithm

       Ln( b0 + b1 e1 + .... + bN-1 bN-1 )   = Ln ( b02 + b12 + ................. + bN-12 )1/2 + A(µ,b0). I

       where  µ = ( b12 + ............... + bN-12 )1/2    and    I = ( b1 e1 + ............. + bN-1 eN-1 ) / µ

>>> Here,  A(µ,b0) generalizes the ATAN2 function to complexes:

-We have to solve  Sin Z = µ / ( µ2 + b02 )1/2  ,  Cos Z = b0 / ( µ2 + b02 )1/2

  it yields  Z = A(µ,b0) = - i Ln ( b0 + i µ ) / ( µ2 + b02 )1/2

>>>  If µ = 0  and  Im(b) # 0 ,  Ln b = Ln b0 + ( b1 e1 + ............. + bN-1 eN-1 ) / b0    ( if  b0 = 0 , Ln b  does not exist )
>>>  If µ = 0  and  Im(b) = 0 ,  Ln b = Ln b0
 

    •  "B^X"  raising a bion to a real power         B^X = exp ( X Ln B )

    •  "X^B"  raising a real to a bionic power       X^B = exp ( B Ln X )

    •  "B^Z"  raising a bion to a complex power         B^Z = exp ( Z Ln B )

    •  "Z*B"  multiplies a bi-on by the complex x + i.y

    •  "SHB"  hyperbolic sine

        Sinh b = ( exp(b) - exp(-b) ) / 2

    •  "CHB"  hyperbolic cosine

        Cosh b = ( exp(b) + exp(-b) ) / 2

    •  "THB"  hyperbolic tangent

          Tanh b = ( exp(2b) - 1 ) ( exp(2b) + 1 ) -1

    •  "ASHB"  arc sinh b = Ln [ b + ( b2 + 1 )1/2 ]

    •  "ACHB"  arc cosh b = Ln [ b + ( b2 - 1 )1/2 ]

    •  "ATHB"   arc tanh b = (1/2) [ Ln ( 1 + b ) - Ln ( 1 - b ) ]

    •  "SINB"   sine

          Sin b = ( exp(i.b) - exp(-i.b) ) / 2.i

    •  "COSB"  cosine

          Cos b = ( exp(i.b) + exp(-i.b) ) / 2

    •  "TANB"    Tan b = - i Tanh ( i.b )

    •  "ASINB"    arc sin b

          Arc Sin b     = - i  Arc Sinh ( i.b )

    •  "ACOSB"  arc cos b

          Arc Cos b = PI/2 - Arc Sin b
 

    •  "ATANB"  arc tan b

          Arc Tan b     = - i  Arc Tanh ( i.b )

Remark:

-I've used     arc cosh b = Ln [ b + ( b2 - 1 )1/2 ]

  instead of the standard definition    Arc Cosh b  = Ln [ b + ( b + 1 )1/2 ( b - 1 )1/2 ]

-So, "ACHB" may give a result that requires a sign change to get the principal value of  Arc Cosh b.
-See the notes below if you prefer the standard definition.
 
 

Data Registers:           •  R00 = 2n ( 4 , 8 , .... , 128 or 256 )    ( Registers R00 thru R2n are to be initialized before executing these programs )

                                      •  R01   ......  •  R2n = the components of the bi-on

   ( In several cases,             R2n+1 ..........  R4n  are used for temporary data storage )

  >>>  When the program stops:     R01   ......  R2n = the components of the result
 

Flag:  F01  ( sometimes )
Subroutines:   ST*A  ST/A  AMOVE  ASWAP  A+A  A-A  B*B1  Z+Z  Z*Z  Z/Z  SQRTZ

-Line 340 is a three-byte  GTO 03
 
 

  01  LBL "X^B"
  02  LN
  03  ST*A
  04  GTO 03
  05  LBL "B^X"
  06  LBL 06
  07  STO O
  08  RCL 00
  09  0
  10  LBL 10
  11  RCL IND Y
  12  ABS
  13  +
  14  DSE Y
  15  GTO 10
  16  X#0?
  17  GTO 00
  18  RCL O
  19  X#0?
  20  GTO 16
  21  SIGN
  22  STO 01
  23  GTO 16
  24  LBL 00
  25  XEQ 05
  26  X<>Y
  27  ST*A
  28  LBL E^B"
  29  LBL 03
  30  XEQ 12
  31  STO M
  32  R-D
  33  1
  34  P-R
  35  RCL Z
  36  STO N
  37  SINH
  38  *
  39  X<> Z
  40  COSH
  41  *
  42  RCL N
  43  RCL M
  44  X=Y?
  45  X#0?
  46  GTO 00
  47  SIGN
  48  STO Z
  49  LBL 00
  50  Z/Z
  51  RCL 02           
  52  R-D
  53  RCL 01
  54  E^X
  55  P-R
  56  Z*Z
  57  .002
  58  XEQ 14
  59  RCL M
  60  R-D
  61  1
  62  P-R
  63  RCL N
  64  COSH
  65  *
  66  X<>Y
  67  RCL N
  68  SINH
  69  *
  70  CHS
  71  X<>Y
  72  RCL 02
  73  R-D
  74  RCL 01
  75  E^X
  76  P-R
  77  Z*Z
  78  STO 01
  79  X<>Y
  80  STO 02
  81  GTO 16
 82  LBL "ACOSB"
  83  XEQ 00
  84  PI
  85  2
  86  /
  87  ST- 01
  88  SIGN
  89  CHS
  90  ST*A
  91  X<>Y
  92  RTN
  93  LBL "ASINB"
  94  LBL 00
  95  XEQ 08
  96  XEQ 02
  97  XEQ 08
  98  SIGN
  99  CHS
100  ST*A
101  X<>Y
102  RTN
103  LBL "ASHB"  
104  LBL 02
105  CF 01
106  GTO 00
107  LBL "ACHB"
108  SF 01
109  LBL 00
110  12
111  AMOVE
112  XEQ "B*B1"
113  SIGN
114  FS? 01
115  CHS
116  ST+ 01
117  .5
118  XEQ 06
119  A+A
120  LBL "LNB"
121  LBL 05
122  DEG
123  RCL 00
124  .002
125  +
126  0
127  LBL 01
128  RCL IND Y
129  X^2
130  +
131  DSE Y
132  GTO 01
133  X=0?
134  GTO 04
135  XEQ 12
136  STO M
137  X^2
138  X<>Y
139  STO P
140  X^2
141  +
142  X#0?
143  GTO 00
144  RCL 02
145  RCL 01
146  1/Z
147  GTO 02
148  LBL 00
149  CLX
150  RCL 02
151  RCL 01
152  Z^2
153  Z+Z
154  SQRTZ
155  X<> 01
156  X<>Y
157  X<> 02           
158  RCL M
159  +
160  X<>Y
161  RCL P
162  -
163  RCL 02
164  RCL 01
165  Z/Z
166  R-P
167  LN
168  CHS
169  X<>Y
170  D-R
171  RCL P
172  RCL M
173  Z/Z
174  LBL 02
175  .002
176  XEQ 14
177  LBL 04
178  RCL 02
179  RCL 01
180  R-P
181  LN
182  STO 01
183  X<>Y
184  D-R
185  STO 02
186  GTO 16
187  LBL "1/B"
188  LBL 07
189  1
190  CHS
191  ST*A
192  ST* 01
193  ST* 02
194  XEQ 12
195  RDN
196  CLX
197  RCL 02
198  RCL 01
199  Z^2
200  Z+Z
201  1/Z
202  0
203  XEQ 14
204  GTO 16
205  LBL "SINB"
206  CF 01
207  GTO 00
208  LBL "COSB"  
209  SF 01
210  LBL 00
211  XEQ 08
212  XEQ 00
213  FS? 01
214  RTN
215  XEQ 08
216  SIGN
217  CHS
218  ST*A
219  X<>Y
220  RTN
221  LBL "SHB"
222  CF 01
223  GTO 00
224  LBL "CHB"
225  SF 01
226  LBL 00
227  12
228  AMOVE
229  SIGN
230  CHS
231  ST*A
232  XEQ 03
233  12
234  ASWAP
235  XEQ 03
236  FC? 01
237  A-A
238  FS? 01
239  A+A
240  2
241  ST/A
242  X<>Y
243  RTN
244  LBL 08
245  RCL 00
246  LBL 09
247  ENTER^
248  SIGN
249  ST- L
250  CLX
251  RCL IND L
252  X<> IND Y
253  CHS
254  STO IND L
255  RDN
256  X<> L
257  DSE X
258  GTO 09
259  RTN
260  LBL "TANB"
261  CF 01
262  GTO 00
263  LBL "ATANB"
264  SF 01
265  LBL 00
266  XEQ 08
267  FC? 01
268  XEQ 02
269  FS? 01
270  XEQ 04
271  XEQ 08
272  SIGN
273  CHS
274  ST*A
275  X<>Y
276  RTN
277  LBL "THB"
278  LBL 02
279  2
280  ST*A
281  XEQ 03
282  12
283  AMOVE
284  1
285  ST- 01
286  12
287  ASWAP
288  SIGN
289  ST+ 01
290  XEQ 07
291  XEQ "B*B1"
292  RTN
293  LBL "ATHB"
294  LBL 04
295  12
296  AMOVE
297  SIGN
298  CHS
299  ST*A
300  ST- 01
301  XEQ 05
302  12
303  ASWAP
304  SIGN
305  ST+ 01
306  XEQ 05
307  A-A
308  2
309  ST/A
310  X<>Y
311  RTN
312  LBL 12
313  DEG
314  RCL 00           
315  .002
316  +
317  STO M
318  CLST
319  LBL 11
320  RCL IND M
321  DSE M
322  RCL IND M
323  Z^2
324  Z+Z
325  DSE M
326  GTO 11
327  X<>Y
328  STO T
329  X<>Y
330  STO Z
331  SQRTZ
332  RTN
333  LBL "B^Z"
334  STO O
335  X<>Y
336  STO N
337  XEQ 05
338  RDN
339  XEQ 00
340  GTO 03
341  LBL 00
342  LBL "Z*B"
343  0
344  LBL 14
345  RCL 00
346  +
347  STO P
348  LBL 13
349  CLX
350  RCL IND P
351  DSE P
352  RCL IND P
353  Z*Z
354  STO IND P
355  CLX
356  RCL P
357  X+1
358  RDN
359  STO IND T
360  DSE P
361  GTO 13
362  RTN
363  LBL 16
364  RCL N
365  RCL O
366  RCL 00           
367   E3
368  /
369  ISG X
370  CLA
371  END

 
          ( 728 bytes / SIZE 2n+1 or 4n+1 )
 
 

      STACK        INPUT      OUTPUT
           X             /         1.2n

   where   1.2n   is the control number of the result.

Exceptions:

-For "B^X" or "X^B" , place x in register X
-For "B^Z"  or "Z*B" , place x in register X and y in register Y  ( z = x + i y )

Examples:   With the biquaternion  b = ( 1 + 0.9 i ) + ( 0.8 + 0.7 i ) e1 + ( 0.6 + 0.5 i ) e2 + ( 0.4 + 0.3 i ) e3

>>>  Biquaternion, so   2n = 8  STO 00

>>>  1  STO 01   0.9  STO 02   0.8  STO 03   0.7  STO 04   0.6  STO 05   0.5  STO 06   0.4  STO 07   0.3  STO 08

-Register R00 is unchanged, but you'll have to store again b in R01 thru R08 after each example.
 

    •  XEQ "1/B"  >>>  1.008    and we find in registers  R01 thru  R08:

       1/b = ( 0.2710 - 0.2285 i ) + ( -0.2115 + 0.1835 i ) e1 + ( -0.1521 + 0.1385 i ) e2 + ( -0.0927 + 0.0936 i ) e3             rounded to 4 decimals

    •  XEQ "E^B"   gives likewise

       exp(b) = ( 3.1095 - 0.0905 i ) + ( 0.7810 + 2.6836 i ) e1 + ( 0.6211 + 1.9573 i ) e2 + ( 0.4613 + 1.2310 i ) e3             rounded to 4 D

   •   XEQ "LNB"

       Ln (b) = ( 0.6669 + 0.7167 i ) + ( 0.6100 - 0.0013 i ) e1 + ( 0.4480 - 0.0118 i ) e2 + ( 0.2860 - 0.0222 i ) e3              rounded to 4 D

    •  XEQ "SHB"

      Sinh b = ( 1.6085 + 0.1583 i ) + ( 0.5553 + 1.2491 i ) e1 + ( 0.4300 + 0.9076 i ) e2 + ( 0.3047 + 0.5662 i ) e3             rounded to 4 D

    •  XEQ "CHB"

      Cosh b = ( 1.5010 - 0.2488 i ) + ( 0.2256 + 1.4345 i ) e1 + ( 0.1911 + 1.0497 i ) e2 + ( 0.1566 + 0.6648 i ) e3             rounded to 4 D

    •  XEQ "THB"

      Tanh b = ( 0.7548 - 1.1142 i ) + ( -0.8316 + 0.1404 i ) e1 + ( -0.6083 + 0.1179 i ) e2 + ( -0.3851 + 0.0953 i ) e3          rounded to 4 D

    •  XEQ "ASHB"

      Asinh b = ( 1.3553 + 0.7183 i ) + ( 0.6025 + 0.0482 i ) e1 + ( 0.4434 + 0.0247 i ) e2 + ( 0.2843 + 0.0013 i ) e3          rounded to 4 D

    •  XEQ "ACHB"

      Acosh b = ( 1.3521 + 0.7113 i ) + ( 0.6185 - 0.0512 i ) e1 + ( 0.4534 - 0.0485 i ) e2 + ( 0.2883 - 0.0459 i ) e3          rounded to 4 D

    •  XEQ "ATHB"

      Atanh b = ( 0.2955 - 0.2011 i ) + ( 0.9797 + 0.2256 i ) e1 + ( 0.7236 + 0.1484 i ) e2 + ( 0.4675 + 0.0711 i ) e3          rounded to 4 D

    •  XEQ "SINB"

      Sin b = ( 0.6434 + 1.7921 i ) + ( 1.3025 + 0.2589 i ) e1 + ( 0.9613 + 0.1671 i ) e2 + ( 0.6201 + 0.0753 i ) e3             rounded to 4 D

    •  XEQ "COSB"

      Cos b = ( 1.6624 - 0.0748 i ) + ( -0.1571 - 1.5114 i ) e1 + ( -0.1421 - 1.1074 i ) e2 + ( -0.1272 - 0.7033 i ) e3          rounded to 4 D

    •  XEQ "TANB"

      Tan b = ( -1.0993 - 0.1510 i ) + ( 0.8538 - 0.8196 i ) e1 + ( 0.6127 - 0.6171 i ) e2 + ( 0.3715 - 0.4146 i ) e3             rounded to 4 D

    •  XEQ "ASINB"

      Asin b = ( 0.7517 + 0.0817 i ) + ( 1.0103 + 0.5534 i ) e1 + ( 0.7519 + 0.3886 i ) e2 + ( 0.4935 + 0.2238 i ) e3          rounded to 4 D

    •  XEQ "ACOSB"

      Acos b = ( 0.8191 - 0.0817 i ) + ( -1.0103 - 0.5534 i ) e1 + ( -0.7519 - 0.3886 i ) e2 + ( -0.4935 - 0.2238 i ) e3          rounded to 4 D

    •  XEQ "ATANB"

      Atan b = ( -0.2551 + 0.2588 i ) + ( 0.2065 + 1.0188 i ) e1 + ( 0.1697 + 0.7447 i ) e2 + ( 0.1329 + 0.4705 i ) e3          rounded to 4 D

    •  "B^X"  with the same b and x = 3.14          3.14  XEQ "B^X"  yields

      b^x = ( 4.0377 - 5.3510 i ) + ( -2.4135 + 2.5059 i ) e1 + ( -1.7284 + 1.8833 i ) e2 + ( -1.0433 + 1.2608 i ) e3          rounded to 4D

    •  Likewise   3.14  XEQ "X^B"  returns:

     x^b = ( 4.0060 - 0.4653 i ) + ( 0.9349 + 3.5690 i ) e1 + ( 0.7498 + 2.6050 i ) e2 + ( 0.5648 + 1.6409 i ) e3                rounded to 4 D

    •  "Z*B"  with the same b and  z = 2 + 3 i     3  ENTER^  2   XEQ "Z*B"

     z.b =  ( -0.7 + 4.8 i ) + ( -0.5 + 3.8 i ) e1 + ( -0.3 + 2.8 i ) e2 + ( -0.1 + 1.8 i ) e3

    •  Likewise   3  ENTER^  2   XEQ "B^Z"   returns:

     b^z = ( -0.4735 + 2.3593 i ) + ( -1.8006 - 0.3988 i ) e1 + ( -1.3296 - 0.2611 i ) e2 + ( -0.8587 - 0.1233 i ) e3          rounded to 4 D

Notes:

-The standard definition of  Arc Cosh b =  Ln [ b + ( b + 1 )1/2 ( b - 1 )1/2 ]  is applied by the following routine:
 
 

 01  LBL "ACHB"
 02  12
 03  AMOVE
 04  13
 05  AMOVE
 06  SIGN
 07  ST+ 01
 08  .5
 09  XEQ "B^X"
 10  12
 11  ASWAP
 12  SIGN
 13  ST- 01
 14  .5
 15  XEQ "B^X"
 16  XEQ "B*B1"
 17  32
 18  AMOVE
 19  A+A
 20  XEQ "LNB"
 21  END

 
   ( 60 bytes / SIZE 6n+1 )
 

-However, since the SIZE = 6n+1,  this variant cannot compute the Arc Cosh  of a bi-64-on !
-This routine may of course be inserted in the programs above to save bytes.

Other elementary functions

-The "self-power function" is defined unambiguously by   b^b = exp ( ( Ln b ) b )
 
 

 01  LBL "B^B0"
 02  12
 03  AMOVE
 04  XEQ "LNB"
 05  XEQ "B*B1"
 06  XEQ "E^B"
 07  END

 
( 31 bytes / SIZE 4n+1 )
 

-The more general function  b^b'  may be defined in several ways.
-If you define it by  b^b' = exp ( ( Ln b ) b' ) ,

>>>  simply replace line 05 above by  XEQ "B*B"  and delete lines 02-03
 

Gudermannian Function
 

Formulae:    Gd(b) = 2 ArcTan [ Tanh (b/2) ]  and its inverse:   Agd(b) = 2 ArcTanh [ Tan(b/2) ]
 
 

 01  LBL "GDB"
 02  2
 03  ST/A
 04  XEQ "THB"
 05  XEQ "ATANB"
 06  2 
 07  ST*A
 08  X<>Y
 09  RTN
 10  LBL "AGDB"
 11  2
 12  ST/A
 13  XEQ "TANB"
 14  XEQ "ATHB"
 15  2
 16  ST*A
 17  X<>Y
 18  END

 
   ( SIZE 4n+1 )
 
 

      STACK        INPUT      OUTPUT
           X            /          1.2n

 
Example:           b = ( 1 + 0.9 i ) + ( 0.8 + 0.7 i ) e1 + ( 0.6 + 0.5 i ) e2 + ( 0.4 + 0.3 i ) e3                       ( biquaternion  ->  8  STO 00 )

 1  STO 01   0.9  STO 02   0.8  STO 03   0.7  STO 04   0.6  STO 05   0.5  STO 06   0.4  STO 07   0.3  STO 08

  XEQ "GDB"   >>>>   1.008       and you find in registers R01 thru R08:

  Gd( b ) = ( -1.0420 + 0.7537 i ) + ( 0.5771 + 1.7617 i ) e1 + ( 0.4551 + 1.2838 i ) e2 + ( 0.3331 + 0.8058 i ) e3         rounded to 4D

-Likewise, you'll find:

  Agd( b ) = ( 0.8355 - 0.6779 i ) + ( 1.4782 + 0.6366 i ) e1 + ( 1.0970 + 0.4414 i ) e2 + ( 0.7158 + 0.2463 i ) e3         rounded to 4D

Notes:

-Of course, this list of functions is not exhaustive...

-Here are also 2 M-Code routines:  Z*B & Z*IMB
-The 1st one does the same job as the focal routine "Z*B" above
-The 2nd one multiplies by z = x+i.y the "imaginary part" of a bion i-e the coefficients of  e1 , e2 , e3 , ............
-It's equivalent to  .002  XEQ 14  in the long program above.
 

082  "B"
02A "*"
01A "Z"
284  CLRF 7
03B  JNC+07
082  "B"
00D "M"
009  "I"
02A "*"
01A "Z"
288  SETF 7
248  SETF 9
321   ?NCXQ                   executes the initialization
3BC  EFC8                       routine listed in paragraph 1°)b)
378  C=c
03C  RCR 3
226   C=C+1 S&X
226   C=C+1 S&X
226   C=C+1 S&X
106   A=C S&X
0B0  C=N ALL
306   ?A<C S&X
0B5   ?NCGO
0A2   DATAERROR         There will be a DATA ERROR message if  R00 = 2n < 4
28C  ?FSET 7
023   JNC+04
23A  C=C+1 M
23A  C=C+1 M
070  N=C ALL
0F8  C=X
068  Z=C
0B8  C=Y
028  T=C
0B0  C=N ALL                  LOOP
268  Q=C
10E  A=C ALL
270  RAMSLCT
038  READATA
0AE  A<>C ALL
266  C=C-1 S&X
270  RAMSLCT
038  READATA
0EE  B<>C ALL
046  C=0 S&X
270  RAMSLCT
0EE  B<>C ALL
0E8  X=C
0AE  A<>C ALL
0A8  Y=C
259   ?NCXQ            The 1st executable word of my Z*Z routine is @F696 in my ROM
3D8   Z*Z                  Change these 2 words according to your own ROM
0B8  C=Y
10E  A=C ALL
0F8  C=X
0EE  B<>C ALL
278  C=Q
070  N=C ALL
270  RAMSLCT
0AE  A<>C ALL
2F0  WRITDATA
0B0  C=N ALL
260  SETHEX
266  C=C-1 S&X
070  N=C ALL
270  RAMSLCT
0EE  B<>C ALL
2F0  WRITDATA
046  C=0 S&X
270  RAMSLCT
0B0  C=N ALL
266  C=C-1 S&X
070  N=C ALL
106  A=C S&X
03C  RCR 3
306  ?A<C S&X
2B3  JNC-42d           GOTO LOOP
046  C
270  =
038  T
0A8  Y=C
078  C=Z
0E8  X=C
3E0  RTN

( 83 words )
 
 

      STACK        INPUTS      OUTPUTS
           Y             y            y
           X             x            x

 
-See above for a numerical example.
 

3°)  Polynomials with Complex Coefficients
 

BPVAL  evaluates  p(b) = cm bm + cm-1 bm-1 + ................ + c1 b + c0    for  a given bion b  and  (m+1) complex numbers  cm , .............. , c1 , c0
 

-Store the bion b in registers  R01 thru R2n  as usual, and the coefficients of the polynomial in Rbb thru Ree  with  bb > 4n
 

Data Registers:           •  R00 = 2n > 3                    ( Registers R00 thru R2n & Rbb thru Ree are to be initialized before executing "BPVAL" )

                                      •  R01   ......  •  R2n = b
                                         Rn+1 ........   R4n = b   ( b is saved in R2n+1 thru R4n )

                                      •  Rbb = Re(cm) ,  •  Rb+1 = Im(cm) , ................. , •  Ree-1 = Re(c0)   •  Ree = Im(c0)

  >>>  When the program stops:     R01   ......  R2n = the n components of p(b)

Flags: /
Subroutine:    ST*A   "B*B1"   STO W   RCL W  ( where W is an extra register cf"A few M-Code Routines for the HP-41" )

-A variant that does not use register W is also listed below.
 
 

 01  LBL "BPVAL"
 02  12
 03  AMOVE
 04  CLX
 05  ST*A
 06  X<>Y
 07  LBL 01
 08  STO W
 09  XEQ "B*B1"
 10  RCL W
 11  RCL IND X
 12  ST+ 01
 13  CLX 
 14  SIGN
 15  +
 16  STO W
 17  RCL IND X
 18  ST+ 02
 19  X<>Y
 20  ISG X
 21  GTO 01
 22  RCL 00
 23   E3
 24  /
 25  ISG X
 26  END

 
  ( 54 bytes )
 
 

      STACK        INPUT      OUTPUT
           X        bbb.eee         1.2n

   where  bbb.eee  is the control number of the polynomial    ( bbb > 4n )

Example:     b = ( 1 + 2 i ) + ( 3 + 4 i ) e1 + ( 5 + 6 i ) e2 + ( 7 + 8 i ) e3                        ( biquaternion  ->  8  STO 00 )

  and     p(b) = ( 2 + 3 i ) b4 + ( 4 - 7 i ) b3 + ( 3 - 5 i ) a2 + ( 1 + 4 i ) a + ( 6 + 2 i )

   1  STO 01   2  STO 02   3  STO 03  ...............................  8  STO 08

-If you choose  bb = 21

   2  STO 21  3  STO 22   4  STO 23   -7  STO 24   3  STO 25   -5  STO 26   1  STO 27   4  STO 28   6  STO 29   2  STO 30

-Control number =  21.030

    21.030   XEQ "BPVAL"  >>>>   1.008                                    ---Execution time = 11s---

    and you get in registers R01 thru R08

  p(b) = ( -39087 - 128086 i ) + ( -863 + 23966 i ) e1 + ( 571 + 37456 i ) e2 + ( 2005 + 50946 i ) e3

Note:

-Here is another version without register W ( in this case, choose  bb > 4n+1 )

   X+1 may be replaced by  1  +
   X/E3 -------------------   E3  /
 
 

 01  LBL "BPVAL"
 02  RCL 00
 03  ST+ X
 04  X+1
 05  X<>Y
 06  STO IND Y
 07  12
 08  AMOVE
 09  CLX
 10  ST*A
 11  LBL 01
 12  XEQ "B*B1" 
 13  RCL 00
 14  ST+ X
 15  X+1
 16  RCL IND X  
 17  RCL IND X
 18  ST+ 01
 19  CLX
 20  SIGN
 21  +
 22  STO IND Y  
 23  RCL IND X
 24  ST+ 02
 25  ISG IND Z   
 26  GTO 01
 27  RCL 00
 28  X/E3
 29  ISG X
 30  END

 
     ( 63 bytes )
 
 

      STACK        INPUT      OUTPUT
           X        bbb.eee         1.2n

   where  bbb.eee  is the control number of the polynomial    ( bbb > 4n+1 )

-Same example >>> same result.
 

4°)  Bionic Equations F(b) = b
 

-The following program again uses the same iterative method that is used for anionic equations:

-The equation must be rewritten in the form:    f ( b ) = b
  and if  f  satisfies a Lipschitz condition   | f(b) - f(b') | < h | b - b' |   with  h < 1  ,   provided b and b' are close to a solution,
  then the sequence  bn+1 = f ( bn )  converges to a root.
 

Data Registers:           •  R00 =  2n  ( 4 , 8 , .... )     ( Registers R00 thru R2n are to be initialized before executing "BEQ" )

                                      •  R01 to R2n = the n components of the bion  b          R4n+1 to R6n: temp  ,  R6n+1 = fname

                                          R2n+1 to R4n  may be used by the subroutine.

     >>>>     When the program stops,        R01 to R2n = the n components of  a solution  b

Flags: /
Subroutine:  A program that takes the bion b   in R01 thru R2n , calculates and stores  f ( b )  in R01 thru R2n
                       without disturbing R4n+1 to R6n+1

-Line 43  X/E3  may be replaced with   E3  /
 
 

 01  LBL "BEQ"
 02  RCL 00
 03  3
 04  *
 05  1
 06  +
 07  ASTO IND X
 08  LBL 01
 09  VIEW 01
 10  13
 11  AMOVE
 12  SIGN
 13  RCL 00
 14  3
 15  *
 16  +
 17  RCL IND X  
 18  XEQ IND X 
 19  3
 20  RCL 00
 21  ST* Y
 22  0
 23  LBL 02
 24  RCL IND Y  
 25  ST- IND T
 26  CLX
 27  RCL IND T 
 28  ABS
 29  +
 30  DSE Z
 31  DSE Y
 32  GTO 02        
 33  X#0?
 34  GTO 01
 35  RCL 00
 36  3
 37  *
 38  1
 39  +
 40  CLA
 41  ARCL IND X
 42  RCL 00
 43  X/E3
 44  ISG X
 45  END

 
        ( 70 bytes / SIZE 6n+2 )
 
 

      STACK        INPUTS      OUTPUTS
        Alpha         f name         f name
           X             /          1.2n

    where  1.2n  = control number of the solution

Example:     Find a solution of the biquaternionic equation

   b2  - Ln b  + ( 0.1 + 0.2 i ) + ( 0.3 + 0.4 i ) e1 + ( 0.5 + 0.6 i ) e2 + ( 0.7 + 0.8 i ) e3 = 0      near   b = 1

-First, we re-write this equation:    b  =  [ Ln b  - {  ( 0.1 + 0.2 i ) + ( 0.3 + 0.4 i ) e1 + ( 0.5 + 0.6 i ) e2 + ( 0.7 + 0.8 i ) e3 } ] 1/2  =  f ( b )

-The short routine "T" hereunder computes  f ( b )
 
 

 01  LBL "T"
 02  XEQ "LNB"
 03  .1
 04  ST- 01
 05  .2
 06  ST- 02
 07  .3
 08  ST- 03
 09  .4
 10  ST- 04
 11  .6
 12  ST- 06
 13  .7
 14  ST- 07
 15  .8
 16  ST- 08
 17  .5
 18  ST- 05
 19  XEQ "B^X"
 20  RTN
 21  END

 
-Then,  2n = 8    STO 00

-Initial approximation:     1  STO 01  CLX  STO 02  STO 03  STO 04  STO 05  STO 06  STO 07  STO 08

-Place the subroutine name in the alpha register:  alpha  "T"  alpha

    XEQ "BEQ"   >>>>    the successive approximations of the real part of the 1st component of the solution are displayed, and after several minutes, we get:

    X =  1.008 = control number of the solution.

-We find in registers R01 thru R08

  b = ( 1.014983106 + 0.292115635 i )  +  ( -0.307551610 - 0.118387777 i )  e1
                                                               + ( -0.489251534 - 0.160080803 i )  e2 + ( -0.670951458 - 0.201773829 i )  e3

Notes:

-To avoid an infinite loop, replace line 33 by  E-8   X<Y?

-The convergence is very slow.
-If  f doesn't satisfy the required Lipschitz condition or if we choose a bad initial guess, the algorithm may be divergent.
-As usual, rewriting the equation in a proper form is often very difficult.

-If you need more registers for your function, replace 3 by a larger number like 4 ( lines 03-14-19-36 ) and replace line 10 by 14 or more.