hp41programs

Moment Inertia

Moments of Inertia for the HP-41


Overview
 

 1°)  Moments of Inertia
 2°)  Tensor of Inertia
 3°)  Quadrupole Tensor
 
 

1°)  Moments of Inertia
 

"MOI" calculates the moments of inertia of a system of n points  Mk ( xk , yk , zk )  with  masses  mk  respectively

    IX = SUM  mk ( yk2 + zk2 )
    IY = SUM  mk ( xk2 + zk2 )           and      IO = SUM  mk ( xk2 + yk2 + zk2 ) = ( IX + IY + IZ ) / 2
    IZ = SUM  mk ( xk2 + yk2 )
 

Data Registers:                                     ( Registers Rbb thru Ree are to be initialized before executing "MOI" )

                                      •  Rbb  =  x1       •  Rb+4 = x2                .........................             •  Ree-3 = xn
                                      •  Rb+1 = y1       •  Rb+5 = y2                .........................             •  Ree-2 = yn
                                      •  Rb+2 = z1       •  Rb+6 = z2                .........................             •  Ree-1 = zn
                                      •  Rb+3 = m1      •  Rb+7 = m2               .........................              •  Ree  =  mn
Flags: /
Subroutines: /
 
 

 01  LBL "MOI"
 02  CLA
 03  STO P
 04  LBL 01
 05  RCL IND P
 06  X^2
 07  ISG P
 08  RCL IND P
 09  X^2
 10  STO Z
 11  ISG P
 12  RCL IND P
 13  X^2
 14  ST+ T
 15  X<> Z
 16  ST+ Z
 17  +
 18  ISG P
 19  RCL IND P
 20  ST* T
 21  ST* Z
 22  *
 23  ST+ O
 24  RDN
 25  ST+ N
 26  X<>Y
 27  ST+ M
 28  ISG P
 29  GTO 01
 30  RCL O       
 31  RCL N
 32  ST+ O
 33  RCL M
 34  ST+ O        
 35  2
 36  ST/ O
 37  X<> O
 38  RDN
 39  CLA
 40  END

 
      ( 74 bytes / SIZE eee+1 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /            IO
           Z             /            IZ
           Y             /            IY
           X       bbb.eee            IX

   where  bbb.eee  =  control number of the array.

Example:    With the 5 points:
 
 

    xk     1    -4      2     -3      5
    yk     2     7     -8     -1      3
    zk     3     1     -2     -4     -7
    mk     7     8      4      5      2

 
-Store, for instance, these 20 numbers into R01 thru R20 ( in column order )

-Then    1.020   XEQ "MOI"  >>>>    IX =  964                                 ---Execution time = 6s---
                                              RDN     IY =  511
                                              RDN     IZ =  945
                                              RDN     IO =  1210

Note:

-With n = 20 points, execution time = 22 seconds.
 

2°)  Tensor of Inertia
 

 "TOI"  calculates   IX , IY , IZ   and

     - IXY = SUM  mk  xk yk
     - IXZ = SUM  mk  xk zk
     - IYZ = SUM  mk  yk zk

-This symmetric tensor is stored in R01 thru R09

         IX         - IXY        - IXZ
      - IXY           IY         - IYZ
      - IXZ        - IYZ            IZ
 

Data Registers:              bb > 09                        ( Registers Rbb thru Ree are to be initialized before executing "TOI" )

                                      •  Rbb  =  x1       •  Rb+4 = x2                .........................             •  Ree-3 = xn
                                      •  Rb+1 = y1       •  Rb+5 = y2                .........................             •  Ree-2 = yn
                                      •  Rb+2 = z1       •  Rb+6 = z2                .........................             •  Ree-1 = zn
                                      •  Rb+3 = m1      •  Rb+7 = m2               .........................             •  Ree  =  mn

       >>> When the program stops,  The tensor of inertia is in registers R01 thru R09

Flags: /
Subroutines: /

-If you don't have an HP41CX, replace line 02-03 by

   0  STO 01  STO 02  STO 03  STO 04  STO 05  STO 06  STO 07  STO 08  STO 09
 
 

 01  LBL "TOI"
 02  1.009
 03  CLRGX
 04  X<>Y
 05  STO P
 06  LBL 01
 07  RCL IND P
 08  STO M
 09  X^2
 10  ISG P
 11  RCL IND P
 12  STO N
 13  X^2
 14  STO Z
 15  ISG P
 16  RCL IND P
 17  STO O
 18  X^2
 19  ST+ T
 20  X<> Z
 21  ST+ Z
 22  +
 23  ISG P
 24  RCL IND P
 25  ST* T
 26  ST* Z
 27  *
 28  ST+ 09
 29  RDN
 30  ST+ 05
 31  X<>Y
 32  ST+ 01
 33  LASTX
 34  RCL M
 35  RCL N
 36  ST* M
 37  RCL O       
 38  R^
 39  ST* M
 40  *
 41  ST* Z
 42  *
 43  ST- 06
 44  ST- 08
 45  X<>Y
 46  ST- 03
 47  ST- 07
 48  X<> M       
 49  ST- 02
 50  ST- 04
 51  ISG P
 52  GTO 01
 53  1.009
 54  CLA
 55  END

 
        ( 107 bytes / SIZE eee+1 )
 
 

      STACK        INPUT      OUTPUT
           X        bbb.eee        1.009

   where  bbb.eee  =  control number of the array,  bbb > 009

Example:    With the 5 points:
 
 

    xk     1    -4      2     -3      5
    yk     2     7     -8     -1      3
    zk     3     1     -2     -4     -7
    mk     7     8      4      5      2

 
-Store, for instance, these 20 numbers into R11 thru R30 ( in column order )
 

-Then   11.030   XEQ "TOI"  >>>>    1.009                                 ---Execution time = 8s---

  and we get in R01 to R09

      964   229    37
      229   511  -140
       37   -140   945
 

Note:

-With n = 20 points, execution time = 37 seconds.
 

3°)  Quadrupole Tensor
 

 "QPT"  calculates the 9 components of the symmetric tensor

           |    SUM  mk ( 2 xk2 -  yk2 - zk2 )            3  SUM  mk  xk yk                          3  SUM  mk  xk zk            |
  Q =   |        3  SUM  mk  xk yk                 SUM  mk ( - xk2 + 2 yk2 - zk2 )              3  SUM  mk  yk zk            |
           |        3  SUM  mk  xk zk                        3  SUM  mk  yk zk                SUM  mk ( - xk2 - yk2 + 2 zk2 )    |
 

-Its Trace equals 0.
 

Data Registers:              R00 = 3                        ( Registers Rbb thru Ree are to be initialized before executing "QPT" )

                                      •  Rbb  =  x1       •  Rb+4 = x2                .........................             •  Ree-3 = xn
                                      •  Rb+1 = y1       •  Rb+5 = y2                .........................             •  Ree-2 = yn
                                      •  Rb+2 = z1       •  Rb+6 = z2                .........................             •  Ree-1 = zn
                                      •  Rb+3 = m1      •  Rb+7 = m2               .........................             •  Ree  =  mn       bb > 09

       >>> When the program stops,  The quadrupole tensor is in registers R01 thru R09

Flags: /
Subroutines: /

-If you don't have an HP41CX, replace line 03-04 by

   0  STO 01  STO 02  STO 03  STO 04  STO 05  STO 06  STO 07  STO 08  STO 09
 
 

 01  LBL "QPT"
 02  STO M
 03  1.009
 04  CLRGX
 05  3
 06  STO 00
 07  LBL 01
 08  RCL IND M
 09  STO N
 10  X^2
 11  ENTER^
 12  ISG M
 13  RCL IND M
 14  STO O
 15  X^2
 16  ST+ Z
 17  ISG M
 18  RCL IND M
 19  STO P
 20  X^2
 21  ST+ T
 22  X<> 00
 23  ST* 00
 24  ST* Y
 25  ST* Z
 26  X<> 00
 27  R^
 28  ST- T
 29  ST- Z
 30  -
 31  ISG M
 32  RCL IND M
 33  ST* T
 34  ST* Z
 35  *
 36  ST+ 09
 37  RDN
 38  ST+ 05
 39  X<>Y
 40  ST+ 01
 41  LASTX 
 42  RCL 00
 43  * 
 44  RCL N
 45  RCL O        
 46  ST* N
 47  RCL P
 48  R^
 49  ST* N
 50  *
 51  ST* Z
 52  *
 53  ST+ 06
 54  ST+ 08
 55  X<>Y
 56  ST+ 03
 57  ST+ 07
 58  X<> N         
 59  ST+ 02
 60  ST+ 04
 61  ISG M
 62  GTO 01
 63  1.009
 64  CLA
 65  END

 
      ( 122 bytes / SIZE eee+1 )
 
 

      STACK        INPUT      OUTPUT
           X        bbb.eee        1.009

   where  bbb.eee  =  control number of the array,  bbb > 009

Example:    With the same 5 points:
 
 

    xk     1    -4      2     -3      5
    yk     2     7     -8     -1      3
    zk     3     1     -2     -4     -7
    mk     7     8      4      5      2

 
-Store, for instance, these 20 numbers into R11 thru R30 ( in column order )
 

-Then   11.030   XEQ "QPT"  >>>>    1.009                                 ---Execution time = 10s---

  and we get in R01 to R09

     -472  -687  -111
     -687   887    420
     -111   420   -415
 

Note:

-With n = 20 points, execution time = 44 seconds.