Post Reply 
(100LX) Technical Applications, Nine Solver Equations
05-04-2017, 01:36 AM
Post: #1
(100LX) Technical Applications, Nine Solver Equations
Code examples from
"Technical Applications, Step-by-Step Solutions For Your HP Calculator"
Hewlett Packard, Edition 2, November 1988
Source: MoHPC DVD

The book provides a chapter on Advanced Solver Techniques followed by a chapter detailing nine application equations. The targets of the book are the HP-27S and HP-19B calculators. The nine applications are
  • Greatest Common Divisor and Least Common Multiple
  • Numerical Integration
  • Numerical Differentiation
  • Factors and Primes
  • Vector Operations
  • Complex Number Operations
  • Triangle Solutions
  • 3 x 3 Matrix Operations
  • Coordinate Transformations
The nine applications in the book have been ported to the HP100LX palmtop and have been tested on the HP95LX. The only syntactical change needed was switching from the colon as an argument separator to the comma character. Interestingly enough, the solver will also accept the colon as separator.

Semantically, changes were made to reorder the variables appearing in the solver menu. One logic change was made to the LCM/GCD application so that entry variables were not modified during calculation. This post will briefly describe each application and provide examples of usage. See the book for details on each algorithm.

Attachments:
The equation library TECHAPPS.TXT and a PDF copy of this post.

How To Use
Transfer the TECHAPPS.TXT file to your HP100LX and rename it TECHAPPS.EQN. From the Business Calculator application use the File Open command to open the Tech Apps equation library or use File Merge to add the applications to the currently open equation library.

Greatest Common Divisor and Least Common Multiple
Enter values for A and B, and then use the GCD or LCM buttons. The original code would alter the values of A and B as GCD was computed, requiring A and B to be reentered to compute LCM. The code has been altered to modify intermediate variables instead.

Code:

{LCM/GCD|0*L(A1,A)*L(B1,B)
+SIGMA(N,0,2.078*LN(G(A1)+1)-.328+1,1,
 IF(G(B1)=0,0,
  0*L(Z,MOD(G(A1),G(B1)))
  +0*L(A1,G(B1))+0*L(B1,G(Z))))
+G(A1)=IF(S(GCD),GCD,A*B/LCM)}

Examples:
A=406, B=266. GCD=14 and LCM=7,714

Numerical Integration
Using Simpson's rule the bounds of the area to be integrated is divided into 2N subintervals. Enter the lower and upper bound values A and B, and the value of N. The function to be integrated must be entered into the body of the code itself (example provided).
Code:

{Integrate|I=L(H,(A-B)/(-2*N))/3*
SIGMA(R,0,2*N,1,0*L(X:A+R*G(H))+
 (SGN(R)+SGN(2*N-R)+2*MOD(R,2))*(
  !START INSERT F(X) HERE START!
   SIN(G(X))   !EXAMPLE. BE SURE TO G(X)!
  !END F(X) END!
))}


Numerical Differentiation
Applications are provided to calculate the first and second derivative of a function at a point. The function must be embedded in the application just as with the numerical integration application. Enter the value of the point X and the limiting value H before using the F'X or F''X button to compute the value of the derivative.

Code:

{dY/dX|F'X=0*L(Q,X)+
 SIGMA(N,-1,1,2,0*L(X,G(Q)+N*H)+N*(
  !START INSERT F(X) HERE START!
   X^2+X+1
  !END F(X) END!
)/(2*H))+0*L(X,G(Q))}


Code:

{d2Y/d2X|F''X=0*L(Q,X)+
SIGMA(N,1,3,1,0*L(X,G(Q)+H*(2-N))+
 (-1)^(N+1)*(2-MOD(N,2))*(
  !START INSERT F(X) HERE START!
  X^3+X^2+X+1
  !END F(X) END!
 )/SQ(H))+
0*L(X,G(Q))}


Factors and Primes
Enter a positive integer N. Each press of the FACT button will display the lowest prime factor of N and then the result of dividing N by that factor. Reduction ends when N and factor are 1.

Code:

{PrimeFactors|FACT=0*L(E,N)+
IF(MOD(N,2)=0,0*L(E,2),
 IF(MOD(N,3)=0,0*L(E,3),
  IF(MOD(N,5)=0,0*L(E,5),
   IF(MOD(N,7)=0,0*L(E,7),L(J,0)
    +SIGMA(D,11,SQRT(N),2,
     IF(G(J)=1,0,
      IF(L(C,MOD(D-10,30))=1 OR G(C)=3 OR
       G(C)=7 OR G(C)=9 OR G(C)=13 OR
       G(C)=19 OR G(C)=21 OR G(C)=27,
        IF(MOD(G(E):D)=0,0*L(J,1)*L(E,D),0),
        0)))))))
+G(E)+L(J,0)*L(N,N/G(E))}

Examples:

N=924. FACT=2, FACT=2, FACT=3, FACT=7, FACT=11, FACT=1.
N=3,623. FACT=3,623, FACT=1. (N is a prime)


Vector Operations
The application can compute the cross product, dot product, the magnitude of a vector, and the angle between two vectors. Vectors are three dimensional and are represented as V1 = (X1, Y1, Z1) and V2 = (X2, Y2, Z2). For cross product, dot product and angle between vectors enter each vector triple. Vector magnitude applies to V1.

Code:

{Vector|0*X1*Y1*Z1*X2*Y2*Z2+IF(S(CROSS),CROSS,
 IF(S(DOT),DOT,
  IF(S(ANG),ANG,MAG)))=
0*L(M,SQRT(SQ(X1)+SQ(Y1)+SQ(Z1)))
+IF(S(DOT) OR S(ANG),
  0*L(C,X1*X2+Y1*Y2+Z1*Z2)
  +IF(S(ANG),
    ACOS(G(C)/(G(M)*SQRT(SQ(X2)+SQ(Y2)+SQ(Z2)))),
    G(C)),
  IF(S(MAG),G(M),
   0*L(A,Z1*X2-X1*Z2)*L(B,X1*Y2-Y1*X2)
   +L(X1,Y1*Z2-Z1*Y2)+0*L(Y1,G(A))+0*L(Z1,G(B))))}


Example:

V1 = (2000, 1460, -820) and V2 = (0.008, -0.0015, -0.0049).
CROSS = -8.3840, V1 = (-8.3840, 3.2400, -14.6800)


Complex Number Operations
This application operates on two complex numbers represented as X = (RX, IX) and Y = (RY, IY). Operations provided include Addition, Subtraction, Multiplication, Division, Logarithm, Power, Inverse and Swap. Enter real and imaginary value pairs for each complex number and then press the desired operation variable. Monadic operators apply to X and the result of dyadic operators is in X. The Swap operation exchanges the values of X and Y.

Code:

{Complex|IF(S(SWAP), !Set Radians for XY and LNX!
 0*(L(R,RX)+L(I,IX))
 -L(RX,RY)+0*(L(IX,IY)+L(RY,G(R))+L(IY,G(I)))
 +SWAP,
 IF(S(MUL) OR S(DIV),
  IF(S(DIV),
   0*(L(RX,RX/SQ(RADIUS(RY,IY)))
    +L(IX,IX/SQ(RADIUS(RY,IY)))
    +L(R,RX*RY+IX*IY)
    +L(IX,IX*RY-RX*IY))
   -L(RX,G(R))
   +DIV,
   0*(L(R,RX*RY-IX*IY)
    +L(IX,IX*RY+RX*IY))
   -L(RX,G(R))
   +MUL),
  IF(S(ADD),
   ADD-L(RX,RX+RY)+0*L(IX,IX+IY),
   IF(S(SUB),
    SUB-L(RX,RX-RY)+0*L(IX,IX-IY),
    IF(S(INV),
     L(RX,RX/L(R,SQ(RADIUS(RX,IX))))
     +0*L(IX,-IX/G(R))
     -INV,
     0*(L(LNX,LN(RADIUS(RX,IX)))
      +L(IX,ANGLE(RX,IX)))
     -L(RX,G(LNX))
     +IF(S(LNX),
       LNX,
       LNX+0*L(R,RX*RY-IX*IY)
       +0*(L(IX,IX*RY+RX*IY)+L(RX,G(R)))
       -L(RX,EXP(G(R))*COS(IX))
       +0*L(IX,SIN(IX)*EXP(G(R)))
     +XY))))))}


Example:
Parallel Impedance:

Zp = 1/(1/Z1 + 1/Z2) where
Z1 = (150, -106.1033), Z2 = (100, 24.5044)

RX=150, IX=-106.1033, RY=100, IY=24.5044
INV, SWAP, INV, ADD, INV
Z1 = (71.8042, -4.3021)

Complex root:

(27, 36)^0.5

RX=27, IX=36, RY=0.5
XY
RX=6, IX=3


Triangle Solutions
Given necessary values for sides S1, S2, S3 and angles A1, A2, A3 of a triangle, the application will compute remaining sides and angles as well as area of the triangle. Triangle solutions include Side-Side-Side (S1,S2,S3), ASA (A3,S1,A1), SAA (S1,A1,A2), SAS (S1,A1,S2) and SSA (S1,S2,A2). Pressing the triangle solution variable following data entry will display the area.

Code:

{Triangle|IF(S(SSS) OR S(SAS),
 0*S1*S2*S3*A1*A2*A3
 +IF(S(SAS),
   0*L(S3,SQRT(SQ(S1)+SQ(S2)-2*S1*S2*COS(G(A1)))),0)
 +0*L(P,(S1+S2+S3)/2)
 +0*L(A3,2*ACOS(SQRT(G(P)*(G(P)-S2)/(S1*S3))))
 +0*L(A2,2*ACOS(SQRT(G(P)*(G(P)-S1)/(S2*S3))))
 +0*L(A1,ACOS(-COS(0*A1+A2+A3)))-.5*S1*S3*SIN(A3)
 +IF(S(SSS),SSS,SAS),
 IF(S(SSA),
  IF(G(FLG)=1 AND S2>S1,
    0*L(A3,2*ASIN(1)-A3)+0*L(FLG,0),
    0*L(FLG,1)+0*L(A3,ASIN(S2*SIN(A2)/S1)))
    +0*L(A1,ACOS(-COS(A2+A3))),
    0)
  +IF(S(SAA),0*L(A3,ACOS(-COS(A1+A2))),0)
  +0*L(A2,ACOS(-COS(A1+A3)))
  +0*L(S2,S1*SIN(A3)/SIN(A2))
  +0*L(S3,S1*COS(A3)+S2*COS(A2))-.5*S1*S3*SIN(A3)
  +IF(S(SSA),SSA,IF(S(SAA),SAA,ASA)))}

Example: Triangular land parcel. Sides are measured from a point with the angle between points.

S1=171.63, S2=297.35, A1=98.2, Press SAS variable.
SAS=25,256.21, S3=363.91, A2=27.83, A3=53.97



3 x 3 Matrix Operations
This application can compute the determinate and inverse (if it exists) of a three by three matrix. Matrix elements are represented by variables A11, A12, ... A32, A33. Enter the value of each individual matrix element, and then press the DET variable to compute the determinate of the matrix. If the determinate is non-zero, then the matrix inverse is stored in the matrix elements A11 to A33.

To solve a system of three linear equations in three unknowns of the form

Ax = C

Enter the matrix element values A11 to A33, then the constant values C1, C2, C3. Press the SIM variable to compute the three unknowns X1, X2, X3.

Code:

{Matrix3x3|0*L(M,1/(0*A11*A12*A13*A21*A22*A23*A31*A32*A33
 +A13*(A21*A32-A22*A31)
 -A12*(-A23*A31+0*A32+A21*A33)
 +A11*(A22*A33-A23*A32)))
*L(A,A22*A33-A23*A32)
*L(B,A12*A33-A13*A32)
*L(C,A12*A23-A13*A22)
*L(D,A21*A33-A23*A31)
*L(E,A11*A33-A13*A31)
*L(F,A11*A23-A13*A21)
*L(G,A21*A32-A22*A31)
*L(A32,G(M)*-(A11*A32-A12*A31))
*L(A33,G(M)*(A11*A22-A12*A21))
+0*L(A11,G(M)*G(A))
*L(A12,G(M)*-G(B))
*L(A13,G(M)*G(C))
*L(A21,G(M)*-G(D))
*L(A22,G(M)*G(E))
*L(A23,G(M)*-G(F))
*L(A31,G(M)*G(G))
+IF(S(SIM),
  L(X1,0*X1*X2*X3+A11*C1+A12*C2+A13*C3)
  +0*L(X2,A21*C1+A22*C2+A23*C3)
  +0*L(X3,A31*C1+A32*C2+A33*C3)
  -SIM,
  1/G(M)-DET)}
{0*L(A1:A)*L(B1:B) !Blows up 1st time on GCD(406,266)!
+SIGMA(N:0:2.078*LN(G(A1)+1)-.328+1:1:
 IF(G(B1)=0:0:
  0*L(Z:MOD(G(A1):G(B1)))
  +0*L(A1:G(B1))+0*L(B1:G(Z))))
+G(A1)=IF(S(GCD):GCD:A*B/LCM)}

Example:
Find the determinate and inverse of the matrix

1 2 3
1 3 3
1 2 4

Enter values A11=1, A12=2, A13=3, etc. then press the DET variable. Result is 1 with the inverse matrix being

6 -2 -3
-1 1 0
-1 0 1

Solve the DC circuit analysis problem generated by summing the voltage drops around three current loops

800i1 - 330i2 + 0i3 = 15
-330i1 + 530i2 - 100i3 = 0
0i1 - 100i2 + 1100i3 = 0

Enter the matrix values as A11=800, A12=-330, A13=0, etc. Enter the constant array as C1=15, C2=0, C3=0. Press the SIM variable to solve for currents.

X1=25.4mA, X2=16.1mA, X3=1.5mA

Coordinate Transformations
This application provides two- or three-dimensional coordinate translation and/or rotation operations. A point is represented by the variables X, Y, Z and the origin is assumed to be (0, 0, 0). The translated point is given by the variables X', Y', Z' and the origin of the translated system is given by the variables X0, Y0, Z0. The rotation angle ANG is in reference to a vector given by A, B, C (right-hand rule). Any values given to A, B, C will be converted to a unit vector by the program. Zero for A, B, C will do only translation.

Pressing the FTRN variable performs forward transformation from the old to new system (X Y Z -> X' Y' Z'), while pressing ITRN performs the inverse transformation from new to old system (X' Y' Z' -> X Y Z).

Code:

{CoordXforms|0*L(A,A/L(D,SQRT(SQ(A)+SQ(B)+SQ(C))))
+0*L(B,B/G(D))
+0*L(C,C/G(D))
+0*L(L1,SQ(A)*L(Q,1-COS(ANG))+COS(ANG))
+0*L(L2,A*B*G(Q)-C*SIN(ANG))
+0*L(L3,A*C*G(Q)+B*SIN(ANG))
+0*L(M1,G(L2)+2*C*SIN(ANG))
+0*L(M2,SQ(B)*G(Q)+COS(ANG))
+0*L(M3,B*C*G(Q)-A*SIN(ANG))
+0*L(N1,G(L3)-2*B*SIN(ANG))
+0*L(N2,G(M3)+2*A*SIN(ANG))
+0*L(N3,SQ(C)*G(Q)+COS(ANG))
+IF(S(FTRN),
 0*X0*Y0*Z0*X*Y*Z
 +L(X',G(L1)*(X-G(X0))+G(M1)*(Y-G(Y0))+G(N1)*(Z-G(Z0)))
 +0*L(Y',G(L2)*(X-X0)+G(M2)*(Y-Y0)+G(N2)*(Z-Z0))
 +0*L(Z',G(L3)*(X-X0)+G(M3)*(Y-Y0)+G(N3)*(Z-Z0))
 -FTRN,
 L(X,G(L1)*X'+G(L2)*Y'+G(L3)*Z'+X0)
 +0*L(Y,G(M1)*X'+G(M2)*Y'+G(M3)*Z'+Y0)
 +0*L(Z,G(N1)*X'+G(N2)*Y'+G(N3)*Z'+Z0)
 -ITRN)}

Example:
Translate point P1(-9,7) and P2(6,8) with origin (0,0) to a system with origin (7,-4) and rotate 27 degrees. For a two dimensional vector, the rotation axis is specified as (0, 0, 1). Then translate point P3'(2.7,-3.6) back to original system.

Enter ANG=27, A=0, B=0, C=1. Enter the system point as X=-9, Y=7. The translated system origin is entered as X0=7, Y0=-4. Press the FTRN variable to get FTRN=X'=-9.2622, Y'=17.06. Enter P2 as X=^, Y=8 then press FTRN to get the translated/rotated point as FTRN=X'=4.5569, Y'=11.1461. Enter new system point P3' as X'=2.7, Y'=-3.6 and press ITRN to get point in original system as ITRN=X=11.0401, Y=-5.9818.

A three dimensional coordinate system is translated to an origin of (2.45,4.00,4.25). Afterwards, a rotation of 62.5 degrees is made about the (0,-1,-1) axis. What are the new coordinates of the point (3.9,2.1,7.0)?

Clear variables then enter ANG=62.5, A=0, B=-1, C=-1. Set new origin coordinates X=02.45, Y0=4.00, Z0=4.25 and enter the sample point X=3.9, Y=2.1, Z=7.0 and press FTRN. The point in the new system is FTRN=X'=3.5861, Y'=0.2609, Z'=0.5891.


Attached File(s)
.txt  TECHAPPS.TXT (Size: 4.43 KB / Downloads: 38)
.pdf  Technical Applications (HP100LX Solver).pdf (Size: 126.05 KB / Downloads: 56)

Remember kids, "In a democracy, you get the government you deserve."
Find all posts by this user
Quote this message in a reply
05-04-2017, 12:41 PM
Post: #2
RE: (100LX) Technical Applications, Nine Solver Equations
(05-04-2017 01:36 AM)mfleming Wrote:  Code examples from
"Technical Applications, Step-by-Step Solutions For Your HP Calculator"
Hewlett Packard, Edition 2, November 1988
Source: MoHPC DVD

...The nine applications in the book have been ported to the HP100LX palmtop and have been tested on the HP95LX....

Excellent, thanks for sharing this. This book is my favorite HP Step-by-Step book, probably my favorite of any of the various Solutions Books. I knew the Solvers were similar in the LX machines, but did not realize they are that similar.

I presume the 200LX would also be compatible?

What s/w can one use on a modern PC to connect to an LX machine to download the file? That much typing on an LX keyboard used to be a challenge, now it's an eye test.

Thanks again for sharing this, it's cool!

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
05-04-2017, 02:47 PM
Post: #3
RE: (100LX) Technical Applications, Nine Solver Equations
(05-04-2017 12:41 PM)rprosperi Wrote:  
(05-04-2017 01:36 AM)mfleming Wrote:  Code examples from
"Technical Applications, Step-by-Step Solutions For Your HP Calculator"
Hewlett Packard, Edition 2, November 1988
Source: MoHPC DVD

...The nine applications in the book have been ported to the HP100LX palmtop and have been tested on the HP95LX....

Excellent, thanks for sharing this. This book is my favorite HP Step-by-Step book, probably my favorite of any of the various Solutions Books. I knew the Solvers were similar in the LX machines, but did not realize they are that similar.

I presume the 200LX would also be compatible?

What s/w can one use on a modern PC to connect to an LX machine to download the file? That much typing on an LX keyboard used to be a challenge, now it's an eye test.

Thanks again for sharing this, it's cool!

Very nice set of solver apps. I sneaker-netted them over to my 200LX on a CF card and they do indeed appear to work fine , but I did not try every one.
Find all posts by this user
Quote this message in a reply
05-04-2017, 06:09 PM
Post: #4
RE: (100LX) Technical Applications, Nine Solver Equations
(05-04-2017 02:47 PM)Paul Berger (Canada) Wrote:  Very nice set of solver apps. I sneaker-netted them over to my 200LX on a CF card and they do indeed appear to work fine , but I did not try every one.

The simple answers are always the best! Until you mentioned this, I forgot I even had some CF cards w/PCMCIA adapters. And these days, to use a PC card slot, one must find a near-vintage PC. ThinkPad to the rescue.

Thanks Paul.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
05-04-2017, 09:24 PM
Post: #5
RE: (100LX) Technical Applications, Nine Solver Equations
(05-04-2017 06:09 PM)rprosperi Wrote:  
(05-04-2017 02:47 PM)Paul Berger (Canada) Wrote:  Very nice set of solver apps. I sneaker-netted them over to my 200LX on a CF card and they do indeed appear to work fine , but I did not try every one.

The simple answers are always the best! Until you mentioned this, I forgot I even had some CF cards w/PCMCIA adapters. And these days, to use a PC card slot, one must find a near-vintage PC. ThinkPad to the rescue.

Thanks Paul.

I just use one of those generic multi-card adapters, in my case from Transend, to copy files from PC to CF card via USB.

I've been a fan of the HP Solver ever since buying an HP17BII, and keying in these programs was one way of understanding how Solver programs work. The Complex Number Operations is particularly nifty. Solver programs still look like uppercase line noise though Smile

~Mark

Remember kids, "In a democracy, you get the government you deserve."
Find all posts by this user
Quote this message in a reply
05-05-2017, 02:02 AM
Post: #6
RE: (100LX) Technical Applications, Nine Solver Equations
(05-04-2017 09:24 PM)mfleming Wrote:  I just use one of those generic multi-card adapters, in my case from Transend, to copy files from PC to CF card via USB.

I've been a fan of the HP Solver ever since buying an HP17BII, and keying in these programs was one way of understanding how Solver programs work. The Complex Number Operations is particularly nifty. Solver programs still look like uppercase line noise though Smile

~Mark

Yes, I dug out a CF card with PC Card adapter today, and will play with the solver on a 200LX this weekend. Thanks for taking the time and frustration to type in all these programs Mark; even RPL is damn friendly looking and far easier to copy than Solver programs.

When I first started seeing some of the larger Solver programs, like Gerson's Trig functions, it immediately reminded me of TECO programs from PDP-11 days in the 70's. TECO is easily the most extreme write-only language I've ever seen. Anyone else recall playing with TECO?

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
Post Reply 




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