hp41programs

Octonions Octonions for the HP-41
 

Overview
 

 1°)  Multiplication

  a)   Program#1
  b)   Program#2

 2°)  Reciprocal
 3°)  Exponential

  a)   Program#1
  b)   Program#2

 4°)  Logarithm
 5°)  Raising an Octonion to a Power

  a)   Real Exponent
  b)   Octonion Exponent

 6°)  Hyperbolic Functions

  a)   Sinh w
  b)   Cosh w
  c)   Tanh w

 7°)  Inverse Hyperbolic Functions

  a)   ArcSinh w
  b)   ArcCosh w
  c)   ArcTanh w

 8°)  Trigonometric Functions

  a)    Sin w
  b)    Cos w
  c)    Tan w

 9°)  Inverse Trigonometric Functions

  a)    ArcSin w
  b)    ArcCos w
  c)    ArcTan w

10°)  Octonionic Equations
 
 
 

1°)  Multiplication of 2 Octonions
 

        a)  Program#1
 

-An octonion is an element  x0 + x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7  of  O = R8

  where ( 1 , e1 , e2 , e3 , e4 , e5 , e6 , e7 )  is the standard basis:

   1  =  ( 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 )
   e1 =  ( 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 )
   e2 =  ( 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 )
   e3 =  ( 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 )
   e4 =  ( 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 )
   e5 =  ( 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 )
   e6 =  ( 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 )
   e7 =  ( 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 )

-Addition and subtraction are defined like ordinary vectors, but the multiplication is more complex:
-Octonions may be regarded as pairs of quaternions and the product is defined by

          ( a , b ) ( c , d ) = ( a c - d* b , d a + b c* )       "Cayley-Dickson doubling"          where   * = conjugate
 

Data Registers:              R00 is unused          ( Registers R09 thru R24 are to be initialized before executing "OO1" )

     >>>>     When the program stops,        R01 to R08 = the 8 components of  w*w'

                                      •  R09 to R16 = the 8 components of the first octonion  w
                                      •  R17 to R24 = the 8 components of the second octonion w'                  R25 to R32: temp
Flags: /
Subroutine:  "Q*Q"  ( cf "Quaternions for the HP-41" )
 
 

  01  LBL "OO1"
  02  RCL 09
  03  STO 01
  04  RCL 10
  05  STO 02
  06  RCL 11
  07  STO 03
  08  RCL 12
  09  STO 04
  10  RCL 17
  11  STO 05
  12  RCL 18
  13  STO 06
  14  RCL 19
  15  STO 07      
  16  RCL 20
  17  STO 08
  18  XEQ "Q*Q"
  19  STO 25
  20  RDN
  21  STO 26
  22  RDN
  23  STO 27
  24  X<>Y
  25  STO 28
  26  RCL 21
  27  CHS
  28  STO 01
  29  RCL 22 
  30  STO 02
  31  RCL 23
  32  STO 03 
  33  RCL 24      
  34  STO 04
  35  RCL 13
  36  STO 05
  37  RCL 14
  38  STO 06
  39  RCL 15
  40  STO 07
  41  RCL 16
  42  STO 08
  43  XEQ "Q*Q"
  44  ST+ 25
  45  RDN
  46  ST+ 26
  47  RDN
  48  ST+ 27
  49  X<>Y
  50  ST+ 28
  51  RCL 21
  52  STO 01
  53  RCL 09
  54  STO 05
  55  RCL 10
  56  STO 06
  57  RCL 11
  58  STO 07
  59  RCL 12
  60  STO 08
  61  XEQ "Q*Q"
  62  STO 29
  63  RDN 
  64  STO 30
  65  RDN
  66  STO 31 
  67  X<>Y
  68  STO 32
  69  RCL 13
  70  STO 01
  71  RCL 14
  72  STO 02
  73  RCL 15
  74  STO 03
  75  RCL 16
  76  STO 04
  77  RCL 17
  78  CHS
  79  STO 05 
  80  RCL 18
  81  STO 06
  82  RCL 19
  83  STO 07
  84  RCL 20
  85  STO 08
  86  XEQ "Q*Q"
  87  ST- 29
  88  RDN
  89  ST- 30
  90  RDN
  91  ST- 31
  92  X<>Y
  93  ST- 32
  94  25.001008
  95  REGMOVE
  96  RCL 04
  97  RCL 03
  98  RCL 02
  99  RCL 01
100  END

 
     ( 175 bytes / SIZE 033 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:

    w = 2 + 4 e1 + 5 e2 + 10 e3 + 3 e4 + 7 e5 + 6 e6 + 9 e7
   w' =  3 + 5 e1 + 6 e2 + 2 e3 + 7 e4 + 4 e5 + 9 e6 + 8 e7

    2   STO 09         3   STO 13                     3   STO 17        7   STO 21
    4   STO 10         7   STO 14                     5   STO 18        4   STO 22
    5   STO 11         6   STO 15                     6   STO 19        9   STO 23
   10  STO 12         9   STO 16                     2   STO 20        8   STO 24

   XEQ "OO1"  >>>>   -239  =  R01                                                            ---Execution time = 9s---
                         RDN     -32  =  R02
                         RDN       74  =  R03
                         RDN     -45   =  R04

   and     R05 = -29  ,  R06 = 134  ,  R07 = 14  ,  R08 = 79

   whence     w.w' = - 239 - 32 e1 + 74 e2 - 45 e3 - 29 e4 + 134 e5 + 14 e6 + 79 e7

Notes:

-There is another "Cayley--Dickson" formula:    ( a , b ) ( c , d ) = ( a c - d b* , a* d + c b )
-But this one doesn't give the correct multiplication table for the quaternions.

-"OO1" uses registers R25 thru R32 which may be avoided with the following program:
 

        b)  Program#2
 

-We can also employ the following multiplication table:
 
 

  w \ w        1       e1       e2       e3       e4       e5       e6       e7
      1        1       e1       e2       e3       e4       e5       e6       e7
     e1       e1      -1       e3      -e2       e5      -e4      -e7       e6
     e2       e2      -e3      -1       e1       e6       e7      -e4      -e5
     e3       e3       e2      -e1      -1       e7      -e6       e5      -e4
     e4       e4      -e5      -e6      -e7      -1       e1       e2       e3
     e5       e5       e4      -e7       e6      -e1      -1      -e3       e2
     e6       e6       e7       e4      -e5      -e2       e3      -1      -e1
     e7       e7      -e6       e5       e4      -e3      -e2       e1      -1

-The multiplication is not associative.
-For example,  ( e2 e5 )  e6 = e7 e6 = e1   whereas    e2 ( e5 e6 ) =  e2 ( - e3 ) = - e1
 
 

Data Registers:              R00 is unused          ( Registers R09 thru R24 are to be initialized before executing "O*O" )

     >>>>     When the program stops,        R01 to R08 = the 8 components of  w*w'

                                      •  R09 to R16 = the 8 components of the first octonion  w
                                      •  R17 to R24 = the 8 components of the second octonion w'
Flags: /
Subroutines: /
 
 

  01  LBL "O*O"
  02  RCL 09
  03  RCL 24     
  04  *
  05  RCL 10
  06  RCL 23
  07  *
  08  -
  09  RCL 11 
  10  RCL 22 
  11  *
  12  +
  13  RCL 12
  14  RCL 21
  15  *
  16  +
  17  RCL 13
  18  RCL 20
  19  *
  20  -
  21  RCL 14
  22  RCL 19
  23  *
  24  -
  25  RCL 15
  26  RCL 18
  27  * 
  28  +
  29  RCL 16
  30  RCL 17
  31  *
  32  +
  33  STO 08
  34  RCL 09
  35  RCL 23
  36  *
  37  RCL 10
  38  RCL 24
  39  *
  40  +
  41  RCL 11
  42  RCL 21
  43  *
  44  +
  45  RCL 12     
  46  RCL 22
  47  *
  48  -
  49  RCL 13
  50  RCL 19
  51  *
  52  - 
  53  RCL 14 
  54  RCL 20 
  55  *
  56  +
  57  RCL 15
  58  RCL 17
  59  *
  60  +
  61  RCL 16
  62  RCL 18
  63  *
  64  -
  65  STO 07
  66  RCL 09
  67  RCL 22
  68  *
  69  RCL 10
  70  RCL 21
  71  *
  72  +
  73  RCL 11
  74  RCL 24
  75  *
  76  -
  77  RCL 12 
  78  RCL 23
  79  *
  80  +
  81  RCL 13
  82  RCL 18
  83  *
  84  -
  85  RCL 14
  86  RCL 17
  87  *
  88  +
  89  RCL 15
  90  RCL 20     
  91  *
  92  -
  93  RCL 16
  94  RCL 19
  95  *
  96  +
  97  STO 06 
  98  RCL 09 
  99  RCL 21
100  *
101  RCL 10
102  RCL 22
103  *
104  -
105  RCL 11
106  RCL 23
107  *
108  -
109  RCL 12
110  RCL 24
111  *
112  -
113  RCL 13
114  RCL 17
115  *
116  +
117  RCL 14
118  RCL 18
119  *
120  +
121  RCL 15
122  RCL 19
123  *
124  +
125  RCL 16
126  RCL 20
127  *
128  +
129  STO 05
130  RCL 09
131  RCL 18
132  *
133  RCL 10
134  RCL 17     
135  *
136  +
137  RCL 11
138  RCL 20
139  *
140  +
141  RCL 12 
142  RCL 19 
143  *
144  -
145  RCL 13
146  RCL 22
147  *
148  +
149  RCL 14
150  RCL 21
151  *
152  -
153  RCL 15
154  RCL 24
155  *
156  -
157  RCL 16
158  RCL 23
159  *
160  +
161  STO 02
162  RCL 09
163  RCL 17
164  *
165  RCL 10
166  RCL 18
167  *
168  -
169  RCL 11
170  RCL 19
171  *
172  -
173  RCL 12
174  RCL 20
175  *
176  -
177  RCL 13
178  RCL 21     
179  *
180  -
181  RCL 14
182  RCL 22
183  *
184  -
185  RCL 15 
186  RCL 23 
187  *
188  -
189  RCL 16
190  RCL 24
191  *
192  -
193  STO 01
194  RCL 09
195  RCL 20
196  *
197  RCL 10
198  RCL 19
199  *
200  +
201  RCL 11
202  RCL 18
203  *
204  -
205  RCL 12
206  RCL 17
207  *
208  +
209  RCL 13
210  RCL 24
211  *
212  +
213  RCL 14
214  RCL 23
215  *
216  -
217  RCL 15
218  RCL 22
219  *
220  +
221  RCL 16     
222  RCL 21
223  *
224  -
225  STO 04
226  RCL 09 
227  RCL 19
228  *
229  RCL 10 
230  RCL 20
231  *
232  -
233  RCL 11
234  RCL 17
235  *
236  +
237  RCL 12
238  RCL 18
239  *
240  +
241  RCL 13
242  RCL 23
243  *
244  +
245  RCL 14
246  RCL 24
247  *
248  +
249  RCL 15
250  RCL 21
251  *
252  -
253  RCL 16
254  RCL 22
255  *
256  -
257  STO 03
258  RCL 02
259  RCL 01
260  END

 
       ( 340 bytes / SIZE 025 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:

    w = 2 + 4 e1 + 5 e2 + 10 e3 + 3 e4 + 7 e5 + 6 e6 + 9 e7
   w' =  3 + 5 e1 + 6 e2 + 2 e3 + 7 e4 + 4 e5 + 9 e6 + 8 e7

    2   STO 09         3   STO 13                     3   STO 17        7   STO 21
    4   STO 10         7   STO 14                     5   STO 18        4   STO 22
    5   STO 11         6   STO 15                     6   STO 19        9   STO 23
   10  STO 12         9   STO 16                     2   STO 20        8   STO 24

   XEQ "O*O"  >>>>   -239  =  R01                                                            ---Execution time = 8s---
                         RDN     -32  =  R02
                         RDN       74  =  R03
                         RDN     -45   =  R04

   and     R05 = -29  ,  R06 = 134  ,  R07 = 14  ,  R08 = 79

   whence     w.w' = - 239 - 32 e1 + 74 e2 - 45 e3 - 29 e4 + 134 e5 + 14 e6 + 79 e7

Notes:

-Registers R09 thru R24 are undisturbed.
-Other multiplication tables may also be found here and there...
 

2°)  Reciprocal of an Octonion
 

-The reciprocal of an octonion w # 0  is given by

    w-1 = w* / | w |2    where w* is the conjugate of  w   and   | w |2 = x02 + x12 + x22 + x32 + x42 + x52 + x62 + x72
 

Data Registers:              R00 is unused          ( Registers R01 thru R08 are to be initialized before executing "1/O" )

                                      •  R01 to R08 = the 8 components of the octonion  w

     >>>>     When the program stops,        R01 to R08 = the 8 components of  1/w  which has replaced w

Flags: /
Subroutines: /
 
 

 01  LBL "1/O"
 02  8
 03  ENTER^
 04  CLX
 05  LBL 00
 06  RCL IND Y
 07  X^2
 08  +
 09  DSE Y
 10  GTO 00
 11  ST/ 01
 12  CHS
 13  ST/ 02
 14  ST/ 03
 15  ST/ 04
 16  ST/ 05
 17  ST/ 06
 18  ST/ 07
 19  ST/ 08
 20  RCL 04
 21  RCL 03
 22  RCL 02
 23  RCL 01
 24  END

 
( 44 bytes / SIZE 009 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y            /             x1
           X             /             x0

 
Example:        w = 2 + 4 e1 + 5 e2 + 10 e3 + 3 e4 + 7 e5 + 6 e6 + 9 e7

    2   STO 01         3   STO 05
    4   STO 02         7   STO 06
    5   STO 03         6   STO 07
   10  STO 04         9   STO 08

   XEQ "1/O"  >>>>   1/160 =  R01                                                            ---Execution time = 2s---
                       RDN   -1/80  =  R02
                       RDN   -1/64  =  R03
                       RDN   -1/32  =  R04

   and     R05 = -3/320  ,  R06 = -7/320  ,  R07 = -3/160  ,  R08 = -9/320        ( approximately )

   whence    1 / w  = 1/160 - 1/80 e1 - 1/64 e2 - 1/32 e3 - 3/320 e4 - 7/320 e5 - 3/160 e6 - 9/320 e7
 

3°)  Exponential of an Octonion
 

        a)  Program#1
 

-The exponential of an octonion w is defined by the series  exp ( w ) = 1 + w + w2/2! + w3/3! + ....... + wn/n! + ........
-A much faster method is used in the next paragraph...
 

Data Registers:              R00: temp           ( Registers R01 thru R08 are to be initialized before executing "EXPO" )

                                      •  R01 to R08 = the 8 components of the octonion  w

                                         R09 thru R32: temp

     >>>>     When the program stops,        R01 to R08 = the 8 components of  exp ( w )  which has replaced w

Flags: /
Subroutine:  "O*O"  ( cf paragraph 1-b )

-Line 110 is a three-byte  GTO 01
 
 

  01  LBL "EXPO"
  02  1.009008
  03  REGMOVE
  04  CLX
  05  STO 00
  06  STO 02 
  07  STO 03
  08  STO 04 
  09  STO 05
  10  STO 06
  11  STO 07
  12  STO 08
  13  STO 18
  14  STO 19
  15  STO 20
  16  STO 21
  17  STO 22
  18  STO 23
  19  STO 24
  20  STO 26
  21  STO 27
  22  STO 28
  23  STO 29
  24  STO 30
  25  STO 31
  26  STO 32
  27  SIGN
  28  STO 01
  29  STO 17 
  30  STO 25 
  31  LBL 01
  32  XEQ "O*O"
  33  ISG 00
  34  CLX
  35  RCL 00
  36  ST/ 01
  37  ST/ 02
  38  ST/ 03
  39  ST/ 04
  40  ST/ 05
  41  ST/ 06
  42  ST/ 07
  43  ST/ 08
  44  1.017008
  45  REGMOVE
  46  RCL 17
  47  RCL 25
  48  +
  49  STO 25
  50  LASTX
  51  -
  52  ABS
  53  RCL 18 
  54  RCL 26 
  55  +
  56  STO 26
  57  LASTX
  58  -
  59  ABS
  60  +
  61  RCL 19
  62  RCL 27
  63  +
  64  STO 27      
  65  LASTX
  66  -
  67  ABS
  68  +
  69  RCL 20
  70  RCL 28
  71  +
  72  STO 28
  73  LASTX
  74  -
  75  ABS
  76  +
  77  RCL 21 
  78  RCL 29 
  79  +
  80  STO 29
  81  LASTX
  82  -
  83  ABS
  84  +
  85  RCL 22
  86  RCL 30
  87  +
  88  STO 30      
  89  LASTX
  90  -
  91  ABS
  92  +
  93  RCL 23
  94  RCL 31
  95  +
  96  STO 31
  97  LASTX
  98  -
  99  ABS
100  +
101  RCL 24 
102  RCL 32
103  +
104  STO 32
105  LASTX
106  -
107  ABS
108  +
109  X#0?
110  GTO 01
111  25.001008
112  REGMOVE
113  RCL 04
114  RCL 03
115  RCL 02
116  RCL 01
117  END

 
   ( 206 bytes / SIZE 033 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:        w = 1 + 0.9 e1 + 0.8 e2 + 0.7 e3 + 0.6 e4 + 0.5 e5 + 0.4 e6 + 0.3 e7

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

    XEQ "EXPO"   >>>>    -0.278200417  = R01                               ---Execution time = 3m36s---
                             RDN      1.454358610  = R02
                             RDN      1.292763208  = R03
                             RDN      1.131167807  = R04

    and   R05 = 0.969572407     R06 = 0.807977006     R07 = 0.646381604    R08 = 0.484786204

-So,  exp w = - 0.278200417 + 1.454358610  e1 + 1.292763208 e2 + 1.131167807 e3
                      + 0.969572407 e4 + 0.807977006 e5 + 0.646381604 e6 + 0.484786204 e7

Notes:

-This program is of course very slow and it would not give accurate results in all cases.
-The following variant is much better:
 

        b)  Program#2
 

-We can also use the following formula to compute exp w

  exp( x0 + x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7 ) = ex0 [ cos µ + ( sin µ ).( x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7 ) / µ ]

    where  µ = ( x12 + x22 + x32 + x42 + x52 + x62 + x72)1/2
 

Data Registers:              R00 is unused          ( Registers R01 thru R08 are to be initialized before executing "E^O" )

                                      •  R01 to R08 = the 8 components of the octonion  w

     >>>>     When the program stops,        R01 to R08 = the 8 components of  exp ( w )  which has replaced w

Flags: /
Subroutines: /
 
 

 01  LBL "E^O"
 02  8.001
 03  DEG
 04  0
 05  LBL 00 
 06  RCL IND Y
 07  X^2
 08  +
 09  DSE Y
 10  GTO 00      
 11  SQRT
 12  ENTER^
 13  R-D
 14  RCL 01
 15  E^X
 16  P-R
 17  STO 01      
 18  X<> Z
 19  X=0?
 20  SIGN
 21  /
 22  ST* 02
 23  ST* 03
 24  ST* 04       
 25  ST* 05
 26  ST* 06
 27  ST* 07
 28  ST* 08
 29  RCL 04 
 30  RCL 03      
 31  RCL 01
 32  END

 
  ( 56 bytes / SIZE 009 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:        w = 1 + 0.9 e1 + 0.8 e2 + 0.7 e3 + 0.6 e4 + 0.5 e5 + 0.4 e6 + 0.3 e7

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

    XEQ "E^O"   >>>>    -0.278200417  = R01                               ---Execution time = 3s---
                          RDN      1.454358610  = R02
                          RDN      1.292763209  = R03
                          RDN      1.131167808  = R04

    and   R05 = 0.969572407     R06 = 0.807977006     R07 = 0.646381604    R08 = 0.484786203

-So,  exp w = - 0.278200417 + 1.454358610  e1 + 1.292763209 e2 + 1.131167808 e3
                      + 0.969572407 e4 + 0.807977006 e5 + 0.646381604 e6 + 0.484786203 e7
 

4°)  Logarithm of an Octonion
 

-"LNO" uses the formula:      Ln( x0 + x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7 )

   = Ln ( x02 + x12 + x22 + x32 + x42 + x52 + x62 + x72 )1/2 + Atan2(µ,x0). ( x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7 ) / µ

    where  µ = ( x12 + x22 + x32 + x42 + x52 + x62 + x72 )1/2

-If  µ = 0  ,   ( x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7 ) / µ   is replaced by  e1
 

Data Registers:              R00 is unused          ( Registers R01 thru R08 are to be initialized before executing "LNO" )

                                      •  R01 to R08 = the 8 components of the octonion  w

     >>>>     When the program stops,        R01 to R08 = the 8 components of  Ln w   which has replaced w

Flags: /
Subroutines: /
 
 

 01  LBL "LNO"
 02  8.001
 03  DEG
 04  0
 05  LBL 00 
 06  RCL IND Y
 07  X^2
 08  +
 09  DSE Y
 10  GTO 00
 11  SQRT
 12  STO Y
 13  LASTX
 14  RCL 01      
 15  X^2
 16  +
 17  SQRT
 18  LN
 19  X<> 01      
 20  R-P
 21  RDN
 22  D-R
 23  X<>Y
 24  X#0?
 25  GTO 01
 26  SIGN
 27  STO 02 
 28  LBL 01       
 29  / 
 30  ST* 02
 31  ST* 03
 32  ST* 04
 33  ST* 05
 34  ST* 06
 35  ST* 07
 36  ST* 08
 37  RCL 04 
 38  RCL 03
 39  RCL 02      
 40  RCL 01
 41  END

 
  ( 66 bytes / SIZE 009 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:        w = 1 + 0.9 e1 + 0.8 e2 + 0.7 e3 + 0.6 e4 + 0.5 e5 + 0.4 e6 + 0.3 e7

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

    XEQ "LNO"   >>>>     0.667500533  = R01                               ---Execution time = 4s---
                           RDN      0.555135626  = R02
                           RDN      0.493453890  = R03
                           RDN      0.431772154  = R04

    and   R05 = 0.370090417     R06 = 0.308408681     R07 = 0.246726945    R08 = 0.185045209

-So,  Ln w =  0.667500533 + 0.555135626  e1 + 0.493453890 e2 + 0.431772154 e3
                   + 0.370090417 e4 + 0.308408681 e5 + 0.246726945 e6 + 0.185045209 e7
 

5°)  Raising an Octonion to a power
 

        a) Real exponent
 

 "O^R"  calculates  wr = exp ( r Ln w )   where  r is a real number and w  is an octonion
 

Data Registers:           •  R00 = r          ( Registers R00 thru R08 are to be initialized before executing "O^R" )

                                      •  R01 to R08 = the 8 components of the octonion  w

     >>>>     When the program stops,        R01 to R08 = the 8 components of  wr  which has replaced w

Flags: /
Subroutines:  "LNO" & "E^O"
 
 

 01  LBL "O^R"
 02  XEQ "LNO"
 03  RCL 00
 04  ST* 01
 05  ST* 02
 06  ST* 03
 07  ST* 04
 08  ST* 05
 09  ST* 06
 10  ST* 07
 11  ST* 08
 12  XEQ "E^O"
 13  END

 
( 37 bytes / SIZE 009 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /            x0

 
Example:        w = 1 + 0.9 e1 + 0.8 e2 + 0.7 e3 + 0.6 e4 + 0.5 e5 + 0.4 e6 + 0.3 e7    and    r = PI

   PI    STO 00

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

    XEQ "O^R"   >>>>    -8.100378660  = R01                               ---Execution time = 8s---
                          RDN     -0.441313119  = R02
                          RDN     -0.392278329  = R03
                          RDN     -0.343243538  = R04

    and   R05 = -0.294208746     R06 = -0.245173955     R07 = -0.196139164    R08 = -0.147104373

-So,  wr =  -8.100378660 - 0.441313119  e1 - 0.392278329 e2 - 0.343243538 e3
                - 0.294208746 e4 - 0.245173955 e5 - 0.196139164 e6 - 0.147104373 e7
 

       b) Octonion exponent
 

 "O^O"  computes  ww' = exp [ ( Ln w ) w' ]  where  w and w'  are 2 octonions
 

Data Registers:              R00: temp           ( Registers R09 thru R24 are to be initialized before executing "O^O" )

     >>>>     When the program stops,        R01 to R08 = the 8 components of  w*w'

                                      •  R09 to R16 = the 8 components of the first octonion  w
                                      •  R17 to R24 = the 8 components of the second octonion w'
Flags: /
Subroutines:  "LNO"  "O*O" and  "E^O"
 
 
 

 01  LBL "O^O"
 02  9.001008
 03  STO 00
 04  REGMOVE
 05  XEQ "LNO"
 06  RCL 00
 07  REGSWAP
 08  XEQ "O*O"
 09  XEQ "E^O"
 10  END

 
( 39 bytes / SIZE 025 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:

    w = 1 + 0.9 e1 + 0.8 e2 + 0.7 e3 + 0.6 e4 + 0.5 e5 + 0.4 e6 + 0.3 e7
   w' = 0.3 + 0.4 e1 + 0.5 e2 + 0.6 e3 + 0.7 e4 + 0.8 e5 + 0.9 e6 + e7

    1     STO 09         0.6   STO 13                     0.3   STO 17        0.7   STO 21
   0.9   STO 10         0.5   STO 14                     0.4   STO 18        0.8   STO 22
   0.8   STO 11         0.4   STO 15                     0.5   STO 19        0.9   STO 23
   0.7   STO 12         0.3   STO 16                     0.6   STO 20         1     STO 24

   XEQ "O^O"  >>>>  -0.079855480 = R01                          ---Execution time = 17s---
                        RDN    0.059815655 = R02
                        RDN    0.074769569 = R03
                        RDN    0.089723483 = R04

  and   R05 = -0.044705977    R06 = 0.082285467   R07 = 0.134585224   R08 = 0.074847451
 

-So,  ww' = - 0.079855480 + 0.059815655 e1 + 0.074769569 e2 +  0.089723483 e3
                  - 0.044705977 e4 + 0.082285467 e5 + 0.134585224 e6 + 0.074847451 e7

Notes:

-Another definition is possible:   ww' = exp [ w'  ( Ln w ) ]
-Simply add   .016  +  REGSWAP  after line 07

-With the same example, it yields:

      ww' =  - 0.079855481 + 0.041142733 e1 + 0.037423725 e2 +  0.033704718 e3
                + 0.179369083 e4 + 0.063612545 e5 + 0.022547694 e6 + 0.093520373 e7
 

6°)  Hyperbolic Functions

        a) Sinh w
 

-We have:  Sinh ( x0 + x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7 )

             =  Sinh x0 Cos µ  + ( Cosh x0 ) ( Sin µ ) / µ  ( x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7 )

    where  µ = ( x12 + x22 + x32 + x42 + x52 + x62 + x72 )1/2
 

Data Registers:              R00 is unused          ( Registers R01 thru R08 are to be initialized before executing "SHO" )

                                      •  R01 to R08 = the 8 components of the octonion  w

     >>>>     When the program stops,        R01 to R08 = the 8 components of  Sinh w   which has replaced w

Flags: /
Subroutines: /
 
 

 01  LBL "SHO"
 02  8.001
 03  DEG
 04  0
 05  LBL 00 
 06  RCL IND Y
 07  X^2
 08  +
 09  DSE Y
 10  GTO 00
 11  SQRT
 12  STO Y
 13  RCL 01      
 14  E^X-1
 15  LASTX
 16  CHS
 17  E^X-1
 18  -
 19  X<>Y
 20  R-D
 21  1
 22  P-R
 23  X<>Y
 24  X<> Z
 25  *
 26  X<> 01       
 27  E^X
 28  LASTX
 29  CHS
 30  E^X
 31  +
 32  *
 33  2
 34  ST/ 01
 35  /
 36  X<>Y
 37  X=0?
 38  SIGN
 39  /
 40  ST* 02       
 41  ST* 03 
 42  ST* 04
 43  ST* 05
 44  ST* 06
 45  ST* 07
 46  ST* 08
 47  RCL 04 
 48  RCL 03       
 49  RCL 02
 50  RCL 01
 51  END

 
   ( 77 bytes / SIZE 009 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /            x1
           X             /             x0

 
Example:        w = 1 + 0.9 e1 + 0.8 e2 + 0.7 e3 + 0.6 e4 + 0.5 e5 + 0.4 e6 + 0.3 e7

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

    XEQ "SHO"   >>>>   -0.120275043  = R01                               ---Execution time = 4s---
                          RDN      0.825592322  = R02
                          RDN      0.733859842  = R03
                          RDN      0.642127362  = R04

    and   R05 = 0.550394881     R06 = 0.458662401     R07 = 0.366929921    R08 = 0.275197441

-Whence,  Sinh w = - 0.120275043 + 0.825592322  e1 + 0.733859842 e2 + 0.642127362 e3
                               + 0.550394881 e4 + 0.458662401 e5 + 0.366929921 e6 + 0.275197441 e7

Notes:

-Of course, this program may be simplified if you have M-Code routines  SINH & COSH
-Delete lines 33 to 35
-Replace lines 27 to 31 by  COSH
-Replace lines 12 to 24 with   ENTER^   R-D  1  P-R  RCL 01  SINH
 

        b) Cosh w
 

-A similar formula gives:  Cosh ( x0 + x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7 )

             =  Cosh x0 Cos µ  + ( Sinh x0 ) ( Sin µ ) / µ  ( x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7 )

    where  µ = ( x12 + x22 + x32 + x42 + x52 + x62 + x72 )1/2
 

Data Registers:              R00 is unused          ( Registers R01 thru R08 are to be initialized before executing "CHO" )

                                      •  R01 to R08 = the 8 components of the octonion  w

     >>>>     When the program stops,        R01 to R08 = the 8 components of  Cosh w   which has replaced w

Flags: /
Subroutines: /
 
 
 

 01  LBL "CHO"
 02  8.001
 03  DEG
 04  0
 05  LBL 00 
 06  RCL IND Y
 07  X^2
 08  +
 09  DSE Y
 10  GTO 00
 11  SQRT
 12  STO Y
 13  RCL 01      
 14  E^X
 15  LASTX
 16  CHS
 17  E^X
 18  +
 19  X<>Y
 20  R-D
 21  1
 22  P-R
 23  X<>Y
 24  X<> Z
 25  *
 26  X<> 01      
 27  E^X-1
 28  LASTX
 29  CHS
 30  E^X-1
 31  -
 32  *
 33  2
 34  ST/ 01
 35  /
 36  X<>Y
 37  X=0?
 38  SIGN
 39  /
 40  ST* 02 
 41  ST* 03       
 42  ST* 04
 43  ST* 05
 44  ST* 06
 45  ST* 07
 46  ST* 08
 47  RCL 04 
 48  RCL 03      
 49  RCL 02
 50  RCL 01
 51  END

 
   ( 77 bytes / SIZE 009 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:        w = 1 + 0.9 e1 + 0.8 e2 + 0.7 e3 + 0.6 e4 + 0.5 e5 + 0.4 e6 + 0.3 e7

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

    XEQ "CHO"   >>>>   -0.157925375  = R01                               ---Execution time = 4s---
                          RDN      0.628766288  = R02
                          RDN      0.558903367  = R03
                          RDN      0.489040446  = R04

    and   R05 = 0.419177525     R06 = 0.349314605     R07 = 0.279451684    R08 = 0.209588763

-Whence,  Cosh w = - 0.157925375 + 0.628766288  e1 + 0.558903367 e2 + 0.489040446 e3
                               + 0.419177525 e4 + 0.349314605 e5 + 0.279451684 e6 + 0.209588763 e7

Notes:

-This program may also be simplified if you have M-Code routines  SINH & COSH
-Delete lines 33 to 35
-Replace lines 27 to 31 by  SINH
-Replace lines 12 to 24 with   ENTER^   R-D  1  P-R  RCL 01  COSH
 

        c) Tanh w
 

-"THO"  calculates  Tanh w = ( Sinh w ) ( Cosh w ) -1
 

Data Registers:              R00: temp                  ( Registers R01 thru R08 are to be initialized before executing "THO" )

                                      •  R01 to R08 = the 8 components of the octonion  w

     >>>>     When the program stops,        R01 to R08 = the 8 components of  Tanh w   which has replaced w

Flags: /
Subroutines:  "CHO"  "1/O"  "SHO"  "O*O"
 
 
 

 01  LBL "THO"
 02  1.009008
 03  STO 00
 04  REGMOVE
 05  XEQ "CHO"
 06  XEQ "1/O"
 07  RCL 00
 08  REGSWAP
 09  XEQ "SHO"
 10  1.009016
 11  REGMOVE
 12  XEQ "O*O"
 13  END 

 
( 54 bytes / SIZE 025 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:        w = 1 + 0.9 e1 + 0.8 e2 + 0.7 e3 + 0.6 e4 + 0.5 e5 + 0.4 e6 + 0.3 e7

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

    XEQ "THO"   >>>>     1.303152093  = R01                               ---Execution time = 23s---
                          RDN     -0.039349080  = R02
                          RDN     -0.034976960  = R03
                          RDN     -0.030604840  = R04

    and   R05 = -0.026232720     R06 = -0.021860600     R07 = -0.017488480    R08 = -0.013116360

-Whence,  Tanh w =  1.303152093 - 0.039349080  e1 - 0.034976960 e2 - 0.030604840 e3
                               - 0.026232720 e4 - 0.021860600 e5 - 0.017488480 e6 - 0.013116360 e7
 

7°)  Inverse Hyperbolic Functions

        a) ArcSinh w
 

 Formula:          ArcSinh w = Ln [ w + ( w2 + 1 )1/2 ]
 

Data Registers:              R00: temp           ( Registers R01 thru R08 are to be initialized before executing "ASHO" )

                                      •  R01 to R08 = the 8 components of the octonion  w           R09 thru R24: temp

     >>>>     When the program stops,        R01 to R08 = the 8 components of  ArcSinh w   which has replaced w

Flags: /
Subroutines:  "O*O"  "O^R"  "LNO"
 
 

 01  LBL "ASHO"
 02  1.009008
 03  REGMOVE
 04  .008
 05  +
 06  REGMOVE
 07  XEQ "O*O"
 08  1
 09  +
 10  STO 01
 11  .5
 12  STO 00
 13  XEQ "O^R"
 14  16
 15  8
 16  LBL 00
 17  RCL IND Y
 18  ST+ IND Y
 19  RDN
 20  DSE Y
 21  DSE X
 22  GTO 00
 23  XEQ "LNO"
 24  END

 
( 65 bytes / SIZE 025 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:        w = 1 + 0.9 e1 + 0.8 e2 + 0.7 e3 + 0.6 e4 + 0.5 e5 + 0.4 e6 + 0.3 e7

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

    XEQ "ASHO"   >>>>     1.334047106  = R01                               ---Execution time = 25s---
                             RDN      0.521197577  = R02
                             RDN      0.463286736  = R03
                             RDN      0.405375894  = R04

    and   R05 = 0.347465051     R06 = 0.289554210     R07 = 0.231643368    R08 = 0.173732526

-Whence,  ArcSinh w =  1.334047106 + 0.521197577  e1 + 0.463286736 e2 + 0.405375894 e3
                                   + 0.347465051 e4 + 0.289554210 e5 + 0.231643368 e6 + 0.173732526 e7

        b) ArcCosh w
 

 Formula:          ArcCosh w = Ln [ w + ( w + 1 )1/2 ( w - 1 )1/2 ]
 

Data Registers:              R00: temp           ( Registers R01 thru R08 are to be initialized before executing "ACHO" )

                                      •  R01 to R08 = the 8 components of the octonion  w           R09 thru R32: temp

     >>>>     When the program stops,        R01 to R08 = the 8 components of  ArcCosh w   which has replaced w

Flags: /
Subroutines:  "O^R"  "O*O"  "LNO"
 
 

 01  LBL "ACHO"
 02  1.025008
 03  REGMOVE
 04  SIGN
 05  ST+ 01 
 06  .5
 07  STO 00 
 08  XEQ "O^R"
 09  1.009008
 10  REGMOVE
 11  25.001008
 12  REGMOVE
 13  SIGN
 14  ST- 01 
 15  XEQ "O^R"
 16  1.017008
 17  REGMOVE
 18  XEQ "O*O"
 19  32
 20  8
 21  LBL 00 
 22  RCL IND Y
 23  ST+ IND Y
 24  RDN
 25  DSE Y
 26  DSE X
 27  GTO 00 
 28  XEQ "LNO"
 29  END

 
   ( 97 bytes / SIZE 033 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:        w = 1 + 0.9 e1 + 0.8 e2 + 0.7 e3 + 0.6 e4 + 0.5 e5 + 0.4 e6 + 0.3 e7

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

    XEQ "ACHO"   >>>>     1.394522838  = R01                               ---Execution time = 35s---
                             RDN      0.583407502  = R02
                             RDN      0.518584446  = R03
                             RDN      0.453761391  = R04

    and   R05 = 0.388938335     R06 = 0.324115279     R07 = 0.259292223    R08 = 0.194469167

-Whence,  ArcCosh w =  1.394522838 + 0.583407502  e1 + 0.518584446 e2 + 0.453761391 e3
                                   + 0.388938335 e4 + 0.324115279 e5 + 0.259292223 e6 + 0.194469167 e7

        c) ArcTanh w
 

 Formula:         ArcTanh w = (1/2) [ Ln ( 1 + w ) - Ln ( 1 - w ) ]
 

Data Registers:              R00: temp           ( Registers R01 thru R08 are to be initialized before executing "ATHO" )

                                      •  R01 to R08 = the 8 components of the octonion  w           R09 thru R16: temp

     >>>>     When the program stops,        R01 to R08 = the 8 components of  ArcTanh w   which has replaced w

Flags: /
Subroutine:    "LNO"
 
 

 01  LBL "ATHO"
 02  1.009008
 03  STO 00 
 04  REGMOVE
 05  SIGN
 06  ST- 01
 07  ST+ 09 
 08  8
 09  X<>Y
 10  CHS
 11  LBL 00 
 12  ST* IND Y
 13  DSE Y
 14  GTO 00 
 15  XEQ "LNO"
 16  RCL 00
 17  REGSWAP
 18  XEQ "LNO"
 19  16
 20  8
 21  LBL 01 
 22  RCL IND X
 23  RCL IND Z
 24  -
 25  2
 26  /
 27  STO IND Y
 28  RDN
 29  DSE Y
 30  DSE X
 31  GTO 01 
 32  RCL 04 
 33  RCL 03
 34  RCL 02 
 35  RCL 01      
 36  END

 
      ( 75 bytes / SIZE 017 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:        w = 1 + 0.9 e1 + 0.8 e2 + 0.7 e3 + 0.6 e4 + 0.5 e5 + 0.4 e6 + 0.3 e7

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

    XEQ "ATHO"   >>>>     0.221825799  = R01                               ---Execution time = 13s---
                             RDN      0.609789268  = R02
                             RDN      0.542034905  = R03
                             RDN      0.474280542  = R04

    and   R05 = 0.406526179     R06 = 0.338771815     R07 = 0.271017452    R08 = 0.203263089

-Whence,  ArcTanh w =  0.221825799 + 0.609789268  e1 + 0.542034905 e2 + 0.474280542 e3
                                    + 0.406526179 e4 + 0.338771815 e5 + 0.271017452 e6 + 0.203263089 e7
 

9°)  Trigonometric Functions

        a) Sin w
 

Formula:     Sin ( x0 + x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7 )

             =  Sin x0 Cosh µ  + ( Cos x0 ) ( Sinh µ ) / µ  ( x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7 )

    where  µ = ( x12 + x22 + x32 + x42 + x52 + x62 + x72 )1/2
 

Data Registers:              R00 is unused          ( Registers R01 thru R08 are to be initialized before executing "SINO" )

                                      •  R01 to R08 = the 8 components of the octonion  w

     >>>>     When the program stops,        R01 to R08 = the 8 components of  Sin w   which has replaced w

Flags: /
Subroutines: /
 
 

 01  LBL "SINO"
 02  8.001
 03  DEG
 04  0
 05  LBL 00 
 06  RCL IND Y
 07  X^2
 08  +
 09  DSE Y
 10  GTO 00
 11  SQRT
 12  RCL 01      
 13  R-D
 14  COS
 15  RCL Y
 16  E^X-1
 17  LASTX
 18  CHS
 19  E^X-1
 20  -
 21  *
 22  X<>Y
 23  X=0?
 24  SIGN
 25  ST+ X
 26  /
 27  ST* 02       
 28  ST* 03 
 29  ST* 04
 30  ST* 05
 31  ST* 06
 32  ST* 07
 33  ST* 08
 34  X<>Y
 35  E^X
 36  LASTX
 37  CHS
 38  E^X
 39  +
 40  RCL 01      
 41  R-D
 42  SIN
 43  *
 44  2
 45  /
 46  STO 01
 47  RCL 04
 48  RCL 03      
 49  RCL 02
 50  R^
 51  END

 
   ( 76 bytes / SIZE 009 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:        w = 0.3 + 0.4 e1 + 0.5 e2 + 0.6 e3 + 0.7 e4 + 0.8 e5 + 0.9 e6 +  e7

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

    XEQ "SINO"   >>>>     1.035598976  = R01                               ---Execution time = 5s---
                            RDN      0.666330457  = R02
                            RDN      0.832913071  = R03
                            RDN      0.999495685  = R04

    and   R05 = 1.166078299     R06 = 1.332660914     R07 = 1.499243528    R08 = 1.665826142

-Whence,  Sin w = 1.035598976 + 0.666330457  e1 + 0.832913071 e2 + 0.999495685 e3
                               + 1.166078299 e4 + 1.332660914 e5 + 1.499243528 e6 + 1.665826142 e7

        b) Cos w
 

Formula:     Cos ( x0 + x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7 )

             =  Cos x0 Cosh µ  + ( Sin x0 ) ( Sinh µ ) / µ  ( x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7 )

    where  µ = ( x12 + x22 + x32 + x42 + x52 + x62 + x72 )1/2
 

Data Registers:              R00 is unused          ( Registers R01 thru R08 are to be initialized before executing "COSO" )

                                      •  R01 to R08 = the 8 components of the octonion  w

     >>>>     When the program stops,        R01 to R08 = the 8 components of  Cos w   which has replaced w

Flags: /
Subroutines: /
 
 

 01  LBL "COSO"
 02  8.001
 03  DEG
 04  0
 05  LBL 00 
 06  RCL IND Y
 07  X^2
 08  +
 09  DSE Y
 10  GTO 00
 11  SQRT
 12  RCL 01      
 13  R-D
 14  COS
 15  RCL Y
 16  E^X
 17  LASTX
 18  CHS
 19  E^X
 20  +
 21  *
 22  2
 23  /
 24  X<> 01      
 25  R-D
 26  SIN
 27  X<>Y
 28  E^X-1
 29  LASTX
 30  CHS
 31  E^X-1
 32  -
 33  *
 34  X<>Y
 35  X=0?
 36  SIGN
 37  ST+ X
 38  /
 39  CHS
 40  ST* 02 
 41  ST* 03       
 42  ST* 04
 43  ST* 05
 44  ST* 06
 45  ST* 07
 46  ST* 08
 47  RCL 04      
 48  RCL 03
 49  RCL 02
 50  RCL 01
 51  END

 
   ( 77 bytes / SIZE 009 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:        w = 0.3 + 0.4 e1 + 0.5 e2 + 0.6 e3 + 0.7 e4 + 0.8 e5 + 0.9 e6 +  e7

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

    XEQ "COSO"   >>>>     3.347809955  = R01                               ---Execution time = 5s---
                             RDN     -0.206120165  = R02
                             RDN     -0.257650206  = R03
                             RDN     -0.309180247  = R04

    and   R05 = -0.360710288     R06 = -0.412240329     R07 = -0.463770370    R08 = -0.515300411

-Whence,  Cos w = 3.347809955 - 0.206120165  e1 - 0.257650206 e2 - 0.309180247 e3
                               - 0.360710288 e4 - 0.412240329 e5 - 0.463770370 e6 - 0.309180247 e7
 

        c) Tan w
 

  Formula:    Tan w = ( Sin w ) ( Cos w ) -1
 

Data Registers:              R00: temp           ( Registers R01 thru R08 are to be initialized before executing "TANO" )

                                      •  R01 to R08 = the 8 components of the octonion  w                R09 to R24: temp

     >>>>     When the program stops,        R01 to R08 = the 8 components of  Tan w   which has replaced w

Flags: /
Subroutines:   "SINO"  "COSO"  "1/O"  "O*O"
 
 

 01  LBL "TANO"
 02  1.009008
 03  STO 00
 04  REGMOVE
 05  XEQ "SINO"
 06  RCL 00
 07  REGSWAP
 08  XEQ "COSO"
 09  XEQ "1/O"
 10  RCL 00
 11  .008
 12  +
 13  REGMOVE
 14  XEQ "O*O"
 15  END

 
( 55 bytes / SIZE 025 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:        w = 0.3 + 0.4 e1 + 0.5 e2 + 0.6 e3 + 0.7 e4 + 0.8 e5 + 0.9 e6 +  e7

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

    XEQ "TANO"   >>>>     0.023154438  = R01                               ---Execution time = 24s---
                             RDN      0.200460320  = R02
                             RDN      0.250575400  = R03
                             RDN      0.300690479  = R04

    and   R05 = 0.350805559     R06 = 0.400920639     R07 = 0.451035719    R08 = 0.501150799

-Whence,  Tan w = 0.023154438 + 0.200460320  e1 + 0.250575400 e2 + 0.300690479 e3
                            + 0.350805559 e4 + 0.400920639 e5 + 0.451035719 e6 + 0.501150799 e7
 

9°)  Inverse Trigonometric Functions

        a) Arc Sin w
 

Formula:     If   w  =  x0 + x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7

     Arc Sin w     = - I  Arc Sinh ( w  I )

    where   I = ( x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7 ) / µ   and   µ = ( x12 + x22 + x32 + x42 + x52 + x62 + x72 )1/2
 

Data Registers:              R00:  temp          ( Registers R01 thru R08 are to be initialized before executing "ASINO" )

                                      •  R01 to R08 = the 8 components of the octonion  w          R10 to R33: temp

     >>>>     When the program stops,        R01 to R08 = the 8 components of  Arc Sin w   which has replaced w

Flags: /
Subroutines:  "O*O"  "ASHO"
 
 

 01  LBL "ASINO"
 02  8.001
 03  ENTER^
 04  CLX
 05  LBL 00          
 06  RCL IND Y
 07  X^2
 08  +
 09  DSE Y
 10  GTO 00         
 11  SQRT
 12  X=0?
 13  SIGN
 14  1.009008
 15  REGMOVE
 16  .008
 17  +
 18  STO 33
 19  REGMOVE
 20  CLX
 21  STO 17         
 22  24.017
 23  RCL Z
 24  LBL 01
 25  ST/ IND Y
 26  DSE Y
 27  GTO 01
 28  17.025008
 29  REGMOVE
 30  XEQ "O*O"
 31  XEQ "ASHO"
 32  RCL 33 
 33  REGMOVE
 34  32
 35  16.008
 36  LBL 02 
 37  RCL IND Y
 38  CHS
 39  STO IND Y
 40  RDN
 41  DSE Y
 42  DSE X
 43  GTO 02 
 44  XEQ "O*O"  
 45  END

 
   ( 121 bytes / SIZE 034 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:        w = 0.3 + 0.4 e1 + 0.5 e2 + 0.6 e3 + 0.7 e4 + 0.8 e5 + 0.9 e6 +  e7

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

    XEQ "ASINO"   >>>>     0.137634053  = R01                               ---Execution time = 53s---
                               RDN      0.294589222  = R02
                               RDN      0.368236527  = R03
                               RDN      0.441883833  = R04

    and   R05 = 0.515531138     R06 = 0.589178444     R07 = 0.662825750    R08 = 0.736473055

-Whence,  Arc Sin w = 0.137634053 + 0.294589222  e1 + 0.368236528 e2 + 0.441883833 e3
                                 + 0.515531139 e4 + 0.589178444 e5 + 0.662825750 e6 + 0.736473055 e7

        b) Arc Cos w
 

Formula:    Arc Cos w = PI/2 - Arc Sin w
 

Data Registers:              R00:  temp          ( Registers R01 thru R08 are to be initialized before executing "ACOSO" )

                                      •  R01 to R08 = the 8 components of the octonion  w          R10 to R33: temp

     >>>>     When the program stops,        R01 to R08 = the 8 components of  Arc Cos w   which has replaced w

Flags: /
Subroutine:    "ASINO"
 
 

 01  LBL "ACOSO"
 02  XEQ "ASINO"
 03  8
 04  PI
 05  2
 06  /
 07  ST- 01
 08  SIGN
 09  CHS
 10  LBL 00
 11  ST* IND Y
 12  DSE Y
 13  GTO 00
 14  RCL 04
 15  RCL 03
 16  RCL 02
 17  RCL 01
 18  END

 
( 38 bytes / SIZE 034 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:        w = 0.3 + 0.4 e1 + 0.5 e2 + 0.6 e3 + 0.7 e4 + 0.8 e5 + 0.9 e6 +  e7

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

    XEQ "ACOSO"   >>>>     1.433162274  = R01                               ---Execution time = 54s---
                                RDN     -0.294589222  = R02
                                RDN     -0.368236527  = R03
                                RDN     -0.441883833  = R04

    and   R05 = -0.515531138     R06 = -0.589178444     R07 = -0.662825750    R08 = -0.736473055

-Whence,  Arc Cos w = 1.433162274 - 0.294589222  e1 - 0.368236527 e2 - 0.441883833 e3
                                 - 0.515531138 e4 - 0.589178444 e5 - 0.662825750 e6 - 0.736473055 e7
 

        c) Arc Tan w
 

Formula:     If   w  =  x0 + x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7

     Arc Tan w     = - I  Arc Tanh ( w  I )

    where   I = ( x1 e1 + x2 e2 + x3 e3 + x4 e4 + x5 e5 + x6 e6 + x7 e7 ) / µ   and   µ = ( x12 + x22 + x32 + x42 + x52 + x62 + x72 )1/2
 

Data Registers:              R00:  temp          ( Registers R01 thru R08 are to be initialized before executing "ATANO" )

                                      •  R01 to R08 = the 8 components of the octonion  w          R10 to R33: temp

     >>>>     When the program stops,        R01 to R08 = the 8 components of  Arc Tan w   which has replaced w

Flags: /
Subroutines:  "O*O"  "ATHO"
 
 

 01  LBL "ATANO"
 02  8.001
 03  ENTER^
 04  CLX
 05  LBL 00 
 06  RCL IND Y
 07  X^2
 08  +
 09  DSE Y
 10  GTO 00 
 11  SQRT
 12  X=0?
 13  SIGN
 14  1.009008
 15  REGMOVE    
 16  .008
 17  +
 18  STO 33
 19  REGMOVE    
 20  CLX
 21  STO 17
 22  24.017
 23  RCL Z
 24  LBL 01 
 25  ST/ IND Y
 26  DSE Y
 27  GTO 01
 28  17.025008
 29  REGMOVE
 30  XEQ "O*O"
 31  XEQ "ATHO"
 32  RCL 33 
 33  REGMOVE    
 34  32
 35  16.008
 36  LBL 02 
 37  RCL IND Y
 38  CHS
 39  STO IND Y
 40  RDN
 41  DSE Y
 42  DSE X
 43  GTO 02 
 44  XEQ "O*O"    
 45  END

 
   ( 121 bytes / SIZE 034 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

 
Example:        w = 1 + 0.9 e1 + 0.8 e2 + 0.7 e3 + 0.6 e4 + 0.5 e5 + 0.4 e6 + 0.3 e7

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

    XEQ "ATANO"   >>>>     1.260671584  = R01                               ---Execution time = 41s---
                                RDN      0.231777953  = R02
                                RDN      0.206024847  = R03
                                RDN      0.180271741  = R04

    and   R05 = 0.154518635     R06 = 0.128765529     R07 = 0.103012424    R08 = 0.077259318

-Whence,  Arc Tan w = 1.260671584 + 0.231777953  e1 + 0.206024847 e2 + 0.180271741 e3
                                  + 0.154518635 e4 + 0.128765529 e5 + 0.103012424 e6 + 0.077259318 e7

Notes:

-The unique difference between "ASINO" & "ATANO" is line 31
-So, we could use a flag to save many bytes...
 

10°)  Octonionic Equations
 

-The following program uses the iterative method also used for quaternionic equations:
-The equation must be rewritten in the form:    f ( w ) = w
  and if  f  satisfies a Lipschitz condition   | f(w) - f(w') | < h | w - w' | with  h < 1  ,   provided w and w' are close to a solution,
  then the sequence  wn+1 = f ( wn )  converges to a root.
 

Data Registers:           •  R00 =  function name          ( Registers R00 thru R08 are to be initialized before executing "OEQ" )

                                      •  R01 to R08 = the 8 components of the octonion  w          R34 to R41 =  w  ,  R42 = fname

     >>>>     When the program stops,        R01 to R08 = the 8 components of  a solution  w

Flags: /
Subroutine:  A program that takes the octonion w   in R01 thru R08 , calculates and stores  f ( w )  in R01 thru R08
                       without disturbing R34 to R42
 
 

 01  LBL "OEQ"
 02  RCL 00
 03  STO 42
 04  LBL 01
 05  VIEW 01
 06  1.034008
 07  REGMOVE
 08  XEQ IND 42
 09  41
 10  8
 11  0
 12  LBL 02
 13  RCL IND Y
 14  ST- IND T
 15  CLX
 16  RCL IND T
 17  ABS
 18  +
 19  DSE Z
 20  DSE Y
 21  GTO 02
 22  X#0?
 23  GTO 01
 24  RCL 42
 25  STO 00
 26  RCL 04
 27  RCL 03
 28  RCL 02
 29  RCL 01
 30  END

 
( 60 bytes / SIZE 043 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /             x3
           Z             /             x2
           Y             /             x1
           X             /             x0

Example:     Find a solution of the equation    w2  - Ln w  + 1 + 0.9 e1 + 0.8 e2 + 0.7 e3 + 0.6 e4 + 0.5 e5 + 0.4 e6 + 0.3 e7 = 0

   near   1 + e1 + e2 + e3 + e4 + e5 + e6 + e7
 

-First, we re-write this equation:    w  =  ( Ln w  - 1 - 0.9 e1 - 0.8 e2 - 0.7 e3 - 0.6 e4 - 0.5 e5 - 0.4 e6 - 0.3 e7 ) 1/2  =  f ( w )

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

 01  LBL "T"
 02  XEQ "LNO"
 03  1
 04  ST- 01
 05  .9
 06  ST- 02
 07  .8
 08  ST- 03
 09  .7
 10  ST- 04
 11  .6
 12  ST- 05
 13  .5
 14  STO 00
 15  ST- 06
 16  .4
 17  ST- 07
 18  .3
 19  ST- 08 
 20  XEQ "O^R"
 21  RTN
 22  END

 
-Then,  "T"  ASTO 00

    1  STO 01  STO 02  STO 03  STO 04  STO 05  STO 06  STO 07  STO 08

    XEQ "OEQ"   >>>>    the successive approximations of the real part of the solution are displayed, and  7m25s later, we get:

                                         1.022547759 = R01
                           RDN    -0.673000419 = R02
                           RDN    -0.598222594 = R03
                           RDN    -0.523444770 = R04

  and   R05 = -0.448666946  ,  R06 = -0.373889121  ,  R07 = -0.299111297  ,  R08 = -0.224333473

-Whence:

        w  =  1.022547759 - 0.673000419  e1 - 0.598222594 e2 - 0.523444770 e3
               - 0.448666946 e4 - 0.373889121 e5 - 0.299111297 e6 - 0.224333473 e7      is a solution of this equation.

Notes:

-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.
-Rewriting the equation in a proper form is often very difficult.

-Instead of displaying the real parts of the successive approximations, you could display the difference between 2 successive approximations:
-Add  VIEW X  after line 18 ( + )  and delete line 05 VIEW 01
-If the algorithm converges, these differences tend to 0.

-The termination criterion  X#0? ( line 22 ) may lead to an infinite loop.
-Line 22 may be replaced by

    E-8        ( or another "small" number )
    X<Y?