hp-19c & 29c solutions mathematics 1977 b&w

Upload: jjirwin

Post on 14-Apr-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    1/40

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    2/40

    INTRODUCTION

    This HP-19C/HP-29C Solutions book was written to help you get the most from your calculator.The programs were chosen to provide useful calculations for many of the common problemsencounteredThey will provide you with immediate capabilities in your everyday calculations and you willfind them useful as guides to programming techniques for writing your own customized software.The comments on each program listing describe the approach used to reach the solution andhelp you follow the programmer's logic as you become an expert on your HP calculator.You will find general information on how to key in and run programs under "A Word about ProgramUsage" in the Applications book you received with your calculator.We hope that this Solutions book will be a valuable tool in your work and would appreciate yourcomments about it.

    The program material contained herein is supplied without representation or warranty of any kind.Hewlett-Packard Company therefore assumes no responsibility and shall have no liability,consequential or otherwise, of any kind arising from the use of this program material or any partthereof.

    HEWLETT-PACKARD COMPANY 1977

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    3/40

    TABLE OF CONTENTS

    CUBIC EQUATION . . . . . . . . . . . I I I I This program extracts a real root from a cubic equation,reducing i t to a quadratic equation and solving it .SYNTHETIC DIVISION . . . . . . . . . . . . .Performs synthetic division on a polynomial of degree less thanor equal to 7 with real coefficients.

    HYPERBOLIC FUNCTIONS/INVERSE HYPERBOLIC FUNCTIONS I I I ICalculates the hyperbolic functions sinh, cosh, tanh, csch, sech,coth, and the inverse of sinh, cosh, tanh, csch, sech, and coth .

    1

    4

    7

    POLYNOMIAL EVALUATION--REAL OR COMPLEX . . . . . . 10Evaluates polynomials with real or complex coefficients.ROOTS OF F (X) = 0 IN AN INTERVAL I I I I I I I I I I I I 13Uses the principle of interval halving to find real roots ofan equation in a closed interval.3 X 3 MATRIX INVERSION . . . . . . . . I I I I .. 14Finds the determinant and the inverse of a given 3 x 3 matrix .BASE b ARITHMETIC I I I I I I I I I I I I . . . 19Performs base conversions and base b arithmetic (addition,subtraction, multiplication and division).GAUSS IAN QUADRATURE FOR arb F (X) dx . . . . . . . . . . . . . 22For a finite range, computes the integral of a single-valuedfunction by the six-point Gauss-Legendre quadrature formula.GAUSSIAN QUADRATURE FOR a/ooF (X) dx ' r ' 25

    For the range between a finite point and positive infinity, computesthe integral of a single-valued function by the six-point GaussLegendre quadrature formula.BESSEL FUNCTION I n (X) ................ 28Computes the value of the Bessel function I n (x) of first kind withan integer order n.GAMMA FUNCTION . . . . . . . I I I I I I I I I I Approximates the"value of the gamma function r(x) for O < x ~ 6 l witheight digit accuracy over most of the range.

    31

    SINE J COSINE AND EXPONENTIAL INTEGRALS I I I I I I I . .. 34Evaluates the sine, cosine and exponential integral by meansof a series approximation.

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    4/40

    CUBIC EQUATION

    This program finds the roots of cubicequations of the formf(x) = x3+ax 2+bx+c=O

    where a, b, and c are real.It does so by extracting the firstroot, performing synthetic division,and solving the resulting quadraticequation (ref: HP-19C/HP-29C Applications Book, p.6).Example 1:

    x3-6x 2+11x-6=OSolution:

    CLRb1.-84 S T D ~-6.88 STa1STOJ

    11.88 STD2'SB!3.88 t t t XlFr's8.25 _t_ oR,'S2.88 t t tRl'S1.88 t t t

    Example 2:x3-4x 2+8x-8=O

    Solution:CLRG

    1.-84 ST08-4.88 STDt8.88 ST02CHS

    STDJ'SFI2.88 U t xp'S-3.88 tU 0'SF21.n t f : t v

    X:'r'1.88 t t t u

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    5/40

    2

    STEP INSTRUCTIONS INPUT KEYS OUTPUTDATA/UNITS DATA/UNITS1. Key in the program c=Jc=Jc:=:J c:=J2. Initialize [T - ] rREG]

    10- 4 ISTID [ 0 -][=-.:=J c-J3. Store coefficients a ~ T O J [T Ib [STiLl [=2]c ~ w : J C:f ]C= __-] ~ _ - ]

    4. Run ~ - ] r . r . ] XlIELs:l [-J 0[- .1 ~ = - ]

    5a If 0>-0. roots are real [RJ.S.J [=_--] X,IR7S-ll- ] X35b If 0

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    6/40

    3

    81 *LBLI 58 ) ( ~ V "82 ReL! 51 t;T078! ReL! 52 RCL584 ABS 53 ST0485 54 RCL886 ST06 55 RCL687 LSTX88 RCL! 57 X(8"89 ABS 58 t;T0818 + 59 t;T09f f RCLIJ 68 tLBL712 *LBL8 61 RCL513 1 62 R.S "*** Xl14 e 63 RCL!15 x 64 +16 X ~ Y " 65 . CHS17 t;T08 66 STOI18 ST07 .. "( C.19 *LBL9 6828 1 69 EHTt21 8 78 X222 ST;7 71 RCL!2J RCLf 72 CHS24 CHS 73 PCL525 STaG 74 x26 tLBL8 75 PCL2') 7 RCL7.. ! 76 +28 RCL6 77 ST03I29 x 78 - D=(b 2 -4ac)/4a 238 RCL4 79 .I?/S Real roots!1 + 88 IX32 ST05 81 Xty!3 RCL4 82 fiBS34 ..nl l -{ : 83 +35 t;T07 84 RCL!36 RCLS 85 EHTt37 RCL! 86 ABS38 + 8739 peLS 88 *** X248 x 89 R/S41 PCL2 98 RCL!42 + 91 ) ( ~ \ '.43 RCL5 92 X344 .:-.:" 93 RTN Irnrnaginary roots45 ReL3 f(x) 94 tLBL2 -D46 + Qr CHS u is in y register47 ST08 96 iX *** v48 ABS Tolerance 97 R..Sr- 49 PCLe REGISTERS

    0 10- 4 1 a 2 b 3 C 4 Used 5 X6 Used 7 Used 8 f(x) 9 .0 .1.2 .3 .4 .5 16 1718 19 20 21 22 2324 25 26 27 28 29

    *** "Printx" may replace "R/S"

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    7/40

    4SYNTHETIC DIVISION

    This program performs syntheticdivision on a polynomial of degree n(with real coefficients)anxn+an_lxn-l+ . . . +alx+ao

    by X-Xo so thatnanx + . . +alx+aO= (x-xo)(b lxn-l+ . . . +b1X+bo)+Rn-

    where b - an-l- nbk= bk+lxo+ak+l for k=n-2, . . . ,aR= boxo+ao

    Note: Program requires n ~ 7 . If n

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    8/40

    5

    STEP INSTRUCTIONS INPUT KEYS OUTPUTDATA/UNITS DATA/UNITSl . Key in the program CJCJc= JC J2. Store coefficients a7 [ENT] ~ Ja6 ITNLJ c=:Jas lENT] [ :J

    a4 l GSS] [ 1 ] a7ao [00][ - Ja2 [ i l l ] [ 1al WiLJ C -]an [] i l l C=:J a33. Run Xo []S[J O ~ b6

    4. Continue for i=5.4 .0. R []lTI C J bi5 Fnr a diffprpnt Xn an tn

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    9/40

    6

    81 tLBL!82 ST0583 RJ84 STa685 R.J..86 Sra?8? IN88 STa889 P/S18 STat11 RJ.12 ST0213 R414 STO.J15 RJ.16 ST04f. , R..S.i10.i.\,.' tLBL219 ST0928 ?"I... STa822 RCLS *** b6R.S...J24 tLBL825 RCL926 x27 PI ' I ... , - I28 + *** b.29 R.S 138 OS?31 brae32 R. .S

    REGISTERS0 i 1 an 2 a 3 a 4 a, 5 a46 as 7 a6 8 a7 9 Xo .0 .1.2 .3 .4 .5 16 1718 19 20 21 22 2324 25 26 27 28 29

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    10/40

    HYPERBOLIC FUNCTIONSINVERSE HYPERBOLIC FUNCTIONS

    This program calculates the hyperbolicfunctions and their inverses.Equations:

    eX _ e-xsinh X = 2eX + -xcosh X = 2 e

    tanh X = sinh xcosh x

    tanh-lx = ~ l n [ ( l + x ) / ( l - x ) J (x 21)Solutions:

    1. 1 1;8B1 8. 183.@@ G ~ B 62.1: j...... 5 . 3 ~ H::;:2. 5.S? ;;2P2 9. -8.7t GSB7

    ez. 52 . ~ ' . ~ : j ' -fl. Sf' ~ . + : .3. 1.3& ;59.? 10. ::.8e GSB44.5.6.

    e.85 H:'8 . ~ 5 GSF:

    G ~ B 4 11.&. 91 .-J.e!? GSP2-1.95 GSB?GSN-1 . 84 .

    1 97 tH

    !? 33 *.'.f'8.51) GSB4!;SP6; 32 f t "'5.48 GSpd

    G S ~ 7e. 10 ~ ' * : . t .

    7

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    11/40

    8

    STEP INSTRUCTIONS INPUT KEYS OUTPUTDATA/UNITS DATA/UNITSl . Key in the program c:=J c:=Jc=Jc=J2. sinh x x [Gill CT J sinh xc=Jc=J3. cosh x x I GSBI C i ~ cosh xc :J c:=J4 tanh x x [Gill [=r] tanh xC J [==:J5. csch x x CGSBJ ~ J[JiS[] CD csch xc::=J c=J6. sech x x CGSaJ o :Jmill Q-=:J sech xc=J [= : J7. coth x x UiSil CIJ[GSB ICD coth xc=Jc=J8. sinh-1x x u;sa:J CD sinh-I xc.=J [==:J9. cosh-Ix X CGSBJ CLI cosh-1 xCJ c= J

    10. tanh-Ix x I GS[] CD tanh-I x1l. csch-1x x [GSB I [TI~ C D csch- I Xr=Jc=J12 sech-1x x em:] CTII GSBICD sech- I xc=J c::=:J13 coth-1x x I GSB ICTI

    I GSB I[IJ coth-1 x[ ~ c = Jc=J c:=Jc=Jc=Jr=Jc=Jc=J c=J[==:J c=J=Jc=Jc=J c::=:J[==:J c=J

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    12/40

    9

    81 tLBLl 58 EHTt82 eX 51 183 Ellrt S2 X:'r'f4 ux +- S4 186 2S5 LSTX87 S6 -138 RTf-! *** sinh x S7 -tL8L2 S8 LN18 eX S9 211 ENTt 6812 tx 61 RTN tanh-'x? oj. 62 1US ***14 21516 P ; I ~ *** cosh x17 tLBL?18 eX19 sro!28 ENP

    21 1/X22 -."", peL!24 L S T ~?E: To27 RTf.! *** tanh x28 *LBL429 1/)(38 PTN ***31 tLBL532 nrr-f'33 X'234 1J5 +I I !37 +38 LN39 RTf.! *** sinh-'x48 tLBL64'. ENT"!'42 )('24J !

    I 44 -45 r '46 oj.47 ,,,L, '413 RTH cosh--' x49 tLBL7 ***REGISTERS

    0 1 Used 2 3 4 56 7 8 9 .0 .1.2 .3 .4 .5 16 1718 19 20 21 22 2324 25 26 27 28 29

    *** IIPrintx ll may be inserted.

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    13/40

    10

    POLYNOMIAL EVALUATION--REAL OR COMPLEX

    This program evaluates polynomials ofthe form:f(xo) = aO+a1x+ . . . +anxn

    where the coefficientsak,k=0, . . . n(n$28) and Xo are realor the coefficients and Xo arecomplex of the form

    ak = Re(a k )+ i 1m (aJZo = Re(zo)+ 1m (zo)

    k = 0, 1, . . . nExample 1:

    f(x) = 11-7x - 3x 2 + 5x 4 + XSfor Xo = 2.5for Xo = -5

    Solution:CLRG

    11.88 GSB!-7.88 P/S-3.88 R.'S8.88 P/S5.88 R/S1.88 R.'S2.58 GSB2267.72 ft* f (2.5)6.88 STa8-5.88 GSB2-29.88 ft * f (-5)

    Example 2:f(x) = (5-7i) - lOx + (-2+i)x 2

    + 18x 3 + (3+4i)x 4for Xo = 2 + i

    Solution:1. 88 fNTt2.88 GSBJ4.88 fHTt3.88 GSB48.88 fHTt18.88 GSB41.88 fHTt-2.88 GSB48.88 fNTt-18.88 GSB4-7.88 fHTt5.88 GSB5

    -186.88 U t Re f (x 0 )R'C228.88 *tf 1m f(x o )

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    14/40

    11

    STEP INSTRUCTIONS INPUT KEYS OUTPUTDATA/UNITS DATA/UNITS1 Kev in th p ' ~ ~ " " l m c=J c=JFor real polynomials: CJ c= J[ ]CJ? Initil'lli7P CO lliliJr=JC:J3. Store coefficients ao LGSB J IT]L ~ L 14. Continue for i = 1 to n, n:;28 ai [RKJ r=JC::=J C JI:; rnmnllt-o . f lv , Xn [S8J CLJ f{xo)u r=J L----=:=J6. For a different Xo go to step 5 n+l []Ill] C[:J

    C = : J L ~For complex polynomials: C = : J C ~7. Enter Xo 1m Xo [OOJ c=J

    Rp Xn L:GSBJ [IJ 0r=Jc=J8. Enter a .k=n.n-l .. . l 1m a CENIJ C=:J" Re a" [ i l l ] LLJC=:J c=J9 Enter an and run 1m an WITJ C=:JRp ; t [GSBJ c:s::::J Rp f ( xn )

    [] i l l c=J 1m f(xo)C=:J C=:J10. For a new case, go to step 7 CJc= JC=:J c=Jr=Jc=Jr=Jc=Jr=Jc=JC=:J C=:J[=:=J [ Jr = JC Jl J C=:JC ~ r = J[ _ ~ r=JC J l ~C] c::=JL ~ c = Jr lC]

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    15/40

    12

    01 fL8L1 58 tLPL9 Add real parts and22 ISZ 51 It'*\' imaginary parts,83 sro; 52 RJ.R/S +65 eTal 54 p.:86 tLBL2 55 +8? E H i ~ 56 X;Y88 EHTt 57 PJ69 ENTt 58 " / ~ Vn..-i1C peLi S9 PTN11 x Multi ply by Xo P/S12 DSZ13 tLBL814 RCLi15 + Multi ply by Xo16f. , DSZ18 GroB19 :cr Divide by28 Xo:?1 p ...e; *** f(xo)22 t.LBL3 Routines for2:: complex polynomials24 STat ry ......,,+ , e26 ST0227 !:l28 tNTt Prepare for LBL 929 ENIt38 E N T ~7 f"'. PTN32 IL8L4CS89GT083S tL8L'536 CSB937 R''''$ *** Re f(xo)38 X;Y39 1m f(xo)40 tLBL8 ***41 Multi ply in polar42 PCLt form4J x44 V"V," i"-I45 RCL246 +47 x : ~ r4e

    RTNREGISTERS

    0 i 1 r or ao 2 e or al 3 a2 4 a 5. . .6 7 8 9 .0 .1.2 .3 .4 .5 16 1718 19 20 21 22 2324 25 26 27 28 29 a28

    *** "Printx" may be inserted or used to replace "RIS".

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    16/40

    ROOTS OF F(X) = 0 IN AN INTERVAL

    This program uses a half-intervalsearch to find the real roots of anequation f(x) = 0 in a closed interval [a,b].The user specifies the continuous,real function f, an interval [a,b],an accuracy tolerance E, and a searchincrement The program then beginsat the left of the interval and com-pares the functional values at theends of the interval [a,a + ~ x ] . Iff(a) and f(a + are of oppositesign, this interval is searched fora root. Otherwise, or even after aroot is found, the program proceedsin the same manner with the interval[a + a + 2 ~ x ] , etc. At most oneroot will be found by the program foreach of these small intervals.33 lines and 22 registers (Ro,R9 - R29 )available for defining f(x)Exampl e 1:Find the roots of x3-8x2 +5x+14 = 0in the interval [-10,10] using =and e: = 10-6Solution:

    !;Toe 1.-86 ST0566 STa8 1.8g ST0667 ., -18.88 ST01'"(,8 rx 18.88 ST076!1 RCL8 GSBl78 x -1.88 u* Xl71 8 RI572 x f(x) 2.88 *u x2n 1vS74 S 7.88 u* X37S RCL8 /?/S76 x 11.88 U.t. b + ~ x,., +I78 179 488 +81 RTN

    Example 2:Find the root of x ~ - 2rx= 0in the interval [1,10] using = 1and e: = 10- 6Solution:

    br0866 !X67 EHTt68 EHTt69 S78 yx f(x)71 x:y72 273 x747S RTN1.-86 STOS1.88 ST0618.88 ST071.88 5101

    GSBI1.41 UI

    13

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    17/40

    14

    STEP INSTRUCTIONS INPUT KEYS OUTPUTDATA/UNITS DATA/UNITS1. Enter program with f(x) defined at LBL 0 CJCJ

    and endinQ with ,RTN c = JC JCJCJ

    2. Store constants E: [SI[] [I:::J/:'x [SfQJ [L Jb l STO I [2:=J

    a UIOJ [ L Jc = JC J3. Run ~ [ I J rootc = JC J

    4 Continue until disDlav = b + f'..x indicatina the [Ri l l C J root orend of search C ~ C J b + /:'Xc = JC J!i For a di.l!.I! f ( x ) n r F > ~ ~ r,ro O c:witrh to c = JC Jprogram mode; key in f(x) ending with g RTN; CJCJ

    switch to run mode and ao to steD 3 c=J c=:JC J c : Jc = JC Jc : J C Jc = JC JCJCJc : J C JCJCJc=J c:::=Jc = JC Jc = JC Jc : J c : Jc=Jc : Jc = JC Jc=J c:::=JeJCJCJCJCJ c= JCJeJC J c : JCJCJc::::J c::::JCJCJCJCJ

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    18/40

    15

    81 *lBU 5'8 RCL5 f(x)

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    19/40

    16

    3 x 3 MATRIX INVERSION

    C' b1 C')= . a2 b2 C2a3 b3 C3has an inverse

    Example:

    A { ~ : -nC' Ci4 a')-I - CisCi2 CisCi3 Ci6 Ci9 Solution:

    where Cil = (b 2C3-b 3c2)/Det _f ~ . ' T ! ) !-7.88 sr!)2Ci2 = (a3 c2-a2 c3)/Det 2. C8 S T O ~Ci3 = (a 2b3- a3b2)/Det ~ . e e SiC4f .8e ,TesCi4 = (b3Cl-b1c3)/Det 3.1)8 " " T I ' ) ~':'; "_,toCis = (alc3-a 3c l)/Det J.81) 5'TG?-1.e8 ,resCi6 (a3 bl-a lb3)/Det 13, 8e ST[!ElGSP!Ci7 (b1crb2Cl )/DetCis = (a2 c l-alc2)/Det

    54.1313 t. . ,: DetS8.86 :1:*.: CilCi9 = (a 1 b2-a2b1)/Det P'S-8,f/4 ...... Ci 2if the determinant Det of A is non- pse. JS .- . Ci3zero. --C. 17 . - ~ . Ci4p"S-8. 11 H* Cis1;' .. ,:,

    13.86 y: ...... Ci 6R/S-8.86 :tH: Ci7p'S8. "37 U t CisP . S-8.82 t ....* Ci 9

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    20/40

    17

    STEP INSTRUCTIONS INPUT KEYS OUTPUTDATA/UNITS DATA/UNITS1. Key in the program CJCJC=:J c:=J2. Store matrix values a l [SIO] [1 J

    a? [STO I[IJa3 [STQ.l IT:Jb1 [Sm] I 4 ]b2 [illi] [5 Jb3 ISTO ] j i ~Cl CSIDJ [LJc" ~ I Q _ J LLJ[ s i o ~ [ 9 ~C ~ [ - = - = ~

    3 Run [SS--] [ T - _ ~ Oet.[ .. -'=J e.::J4. For k = 1 2. ... 9 Ws 1c= l Ci.kC][- ][ - - -JCJ

    L_ l c=JCJc:=JL_ J [ ~[ J ~L=-:::J C ~ JC = J l ~[ - ~ ~ ] c=JL - ~ J c:=JL:=J L--.=:lC= ]C JLJCJ[=--.=J CJ

    r - J ~ lr----=l [ -It=.--.J [ _ ~[ ~ [ - ~ ~ ~ _ J[:=:---J C-J[ ___J [- ---I[--.1 [-==]L-] r- ]- - - - - - - - ._-I _ J C Jr ---] [- - ]

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    21/40

    18

    B1 .LBL8 58 PCL282 x 51 &5B9B3 x 52 PCL984 PTN 53 RCL48S .LBLl 54 RCL7B6 PCLl '5 Relo87 PCLS 56 GS8988 PCL9 57 PCL789 &5B8 58 RCl318 PCl2 59 RCl911 PCL6 68 pelt12 PCL7 61 '58913 &5B8 62 RCL614 + 63 (lCLt1S RCL3 64 PCl316 PCL4 6S RCl417 RCl8 66 SSB.918 GSB8 67 Rel?19 + 68 RClS28 pcn 69 flCL821 PCLS 78 PCL422 PCl7 71 GSB923 GSBB 72 PCL824 - 73 PCL12S PCl2 74 PCL72f PCL4 ..I. PCL227 RCL9 76 GSB928 GS8B .,., PCL4i29 - 78 PCL238 RCL1 79 PelS31 PCLf 88 PCL132 PCLS 81 .LBL933 GSB8 82 x34 - 8335 PlS Determinant 84 x36 ST. 8 8S )(:y77 RCL8 86 PJ..,';38 PClf 87 -39 PCL9 88 RC.848 PCLS 8941 GSB9 98 PIS42 PCL9 91 RTN43 PCL244 RCLS4S Rcn46 GSB947 PCLS48 RCl349 PCLf

    REGISTERS0 1 al 2 a2 3 a36 b3 7 Cl 8 C2 9 C3.2 .3 .4 .518 19 20 2124 25 26 27

    *** "Printx" may be used to replace "R/S".

    4 b1.0 D162228

    *** CXk

    5.1172329

    b2

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    22/40

    BASE b ARITHMETIC

    Given positive integers x and y, thisprogram computes Yb 0 xbwhere the operation 0 can be +, -, x,- . In division, the remainder istruncated.The program can also be used to perform base conversions. When the basehas two digits, two digits are allocated in the display. For example2B07 16 would appear as 2121407.Reference:"Applications Programs, Volume 2",Adams, ed. Int ' l . Software Clearinghouse, Estacada, Oregon, 1977.Examples:

    l . 213 8+37507 82. 12 8 - 37 83. 12345 8x4567 84. 16 8 -;-4 85. A3C9 16 -+ Basel 06. 30690 10 -+ Base 16

    Solutions:e. C : ' ' f r ~213. ~ N T - t37587. ~ 8 ~ 1

    7",7"" .f: .*..'i ; .;,. ....12. ENT fJ7. GSB2

    - 2 ~ . tU12J45. E N T ~4 ~ F ' . GSB?

    61341563. .t:lJ/:E. ~ N : - r4. :;5B4J. t ~ : . t16. ST07-18931239. r;SBr41929. ~ : ~ : ~ :38698. GSB8

    CPS7871482. t .. *

    19

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    23/40

    20

    STEP INSTRUCTIONS INPUT KEYS OUTPUTDATA/UNITS DATA/UNITSl . Initialize disDlav IT ] [fix Il:=[J c=Jc=J I _ I2. Store base b [SIiL] IT 1C=-] [__ J3. Y + x y [l[tJ L J

    x [GsiJ L_u y + x[ ~ = ] [-=-1

    4. Y - x y [tNT 1[-_ Ix IGsIU [1_] y - xL- - l [---1----- - - - - - -- -- - -

    5. Y x Y [ENf-1 r-- --I- - - ----- ". -x LGSB J [_ 3 I y xI --_. -]1 _ I6. Y x Note: remainder is truncated y rENT I L Jx [GSS] r It 1 y . ; . ~I - 1 [ - -. ]

    L Jr _.1For base conversions:~ Stnrp h ~ c o h lSTO I [-i]I I I __. _ 12 To convert an inteaer in base b to base N I CHS I [ I

    IV u [GSB I [ 0 I N,nI I [ J3. To convert an integer in base 10 to base b N,n IGSB J [() IlCHS] L--- J Nh1_ I [ 1[ I I ._ -1L_ 1L_ _I[ 1 [ -_ 11- ] I - I[ I [ .I[ II J[ I [ JI I [ 1[ I _ ~ _ - I[ I [ - 1I II - II I I II J [ _ ]

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    24/40

    21

    81 *LBLS 58 RCL782 CHS -x 51 Lab83 G5B8 52 IHT84 x:y 53 185 CHS -Y 54 5T0386 GSB8 55 +87 RTH 5 18K88 *LBLl S T ~ lxb Yb ... i89 G5B9 58 RCL418 + YlO x10 59 X(8"11 GSB8 -+ Base b 68 GT0812 CHS 61 IU13 p/s *** Y + x 62 sms14 *LBL2 xb Yb 63 RCL715 GSB9 64 STOl16 x : ~ ' Y10 x10 65 *LBL817 - y-x 66 RCL418 X(8" 67 *LBL719 GT06 -+ Base b 68 RCLt28 GSB8 6921 CHS *** Y - x 78 STa622 p...-s 71 FPC23 *LBL6 72 ReLl24 CHS 73 .r25 G5B8 74 RCl326 I ? " ~ ' 75 x27 *LBL:? 76 En:28 GSB? 77 "!29 x 78 +38 bSB8 79 lSTX71 eMS 88'. -32 P'S *** Y x 81 SI+2n * L B L ~ 82 pelS34 r,SB9 83 sney ~ ' , ' 84 RCl6;3 85 IHTr,SBe 86 X#8"3E' eMS *** Y ~ x 87 GT0770 p'S 88 RCl8'- base 108 :tLBU' Base b to 89 RCl241 HIT Base 10 to base b 98 CHE'42 peL? conversion routine 91 RTN43 [LRG44 ST05 -t45 S10746 RJ.47 ST0448 RJ.49 STOB REGISTERS

    0 Used 1 Used 2 Used 3 Used 4 Used 5 Used6 Used 7 Used 8 9 .0 .1.2 .3 .4 .5 16 1718 19 20 21 22 2324 25 26 27 28 29

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    25/40

    22

    GAUSSIAN QUADRATURE ~ F(x) dxThis program computes the value of

    bj f(x) dxfor finite a and b, and an f(x) whichis single-valued in the range [a,b],using the six point Gauss-legendrequadrature formula:

    where:

    Jb f ( x ) ~ab-a f (Zi (b-a) + b + a-2 - /.., w1i=l 2

    Zl =-Z2 = .238619186Z3 = - z ~ = .661209386Zs =-Z6 = .932469514WI = w2 = .467913935W3 = = .360761573Ws = W6 = .17132449233 lines and 20 registers (R. 0-R 29 )are available to define f(x).

    Reference: Applied Numerical Methods.Carnahan, Luther, andWilks; John Wiley andSons, 1969.

    Examples: f lO dx1. xSolutions:

    1

    dxx{1nxp

    8.238619186 5TOI8.661289386 5T028.932469514 5T038.467913935 5T048.36'761573 5T058.171324492 5T06

    GT0266 l/X67 RTH1.88 rHTt18.88 G5812.3' '"FIX8

    2.38148888 '"GT0266 EHTt67 LH68 369 yx78 x

    71 l/X72 RTH"1.8888. ' eXEHTt

    X2G5818.37497974 , .

    The correct answers are:1. 1n 102. 3/8

    f(x)

    f(x)

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    26/40

    23

    STEP INSTRUCTIONS INPUT KEYS OUTPUTDATA/UNITS DATA/UNITSl . Kev in the proclram and swi tch to run mode CJCJ

    [=:J C J2. Store constants: 238619186 [sIol LLJ661209386 [SffiJ !IJ932469514 [STO I [L J467913935 Lsi(L] [L J360761573 [SI(iJ u=J.171324492 [Sffi] CLJc::::=J ~ J

    3. Go to Label 2 []TO I[IJc::::=J c:=J4. Switch to program mode and key in f(x). C : : ~ c::::=JInclude a RTN statement c::::=J L ~C ~ c::::J5. Switch to run mode c::::=J c:=Jc::::=J c=J6. Key in limits and run a IENTtl C J

    b CGSBJ IT] ff(x)c::::=J c:=J7. For a new case, go to step 3. c::::=J c::::=JCJCJCJc:=Jc::::=J c:=JCJCJc::::=J CJc::::=J CJc::::=J c:=Jc::::=J c:=Jc::::=J CJ

    CJCJc::::=J c:=Jc::::=J c::::=Jc::::=J c::::=Jc=J c::::=JC J c::::=Jc:=J c::::=Jr- lCJc::::=J c::::=JC J c::::=J

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    27/40

    24

    81 fLBL! 58 ***JOf(x) dx2 5T0883 5T07 51 R/584 N 52 fLBU85 5T+7 S3 RCLl86 5T-8 54 RCL887 8 55 x88 S109 56 RCL789 1 57 +18 CH5 58 211 5108 Clear flag 59 -12 fLBL8 68 C5B213 C5B9 61 RCL414 RCLl 62 x15 RCL2 63 5T+916 S101 64 RTH f(x)17 XtY 65 fLBL218 ST02 66 R . ~ S19 RCL428 RCL521 510422 XtY23 ST0524 C5B925 RCLl26 RCD27 STa128 XtY29 STa338 RCL431 RCL632 STa433 XtY34 S10635 CSB936 RCL8 Test flag37 X.>8?38 C10S39 fLBL6 -148 STx141 STx242 STx343 STx8 Set flag44 C10845 fLBL846 RCL947 RCL848 x49 2 REGISTERS

    0 Flag 1 ZI (Z2) 2 Z.3. iZ4) 3 Zs (Z6) 4 WI (W2 ) 5 W3 (W4)6 (We.) 7 b 8 b - a 9 Used .0 .1a +.2 .3 .4 .5 16 1718 19 20 21 22 2324 25 26 27 28 29

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    28/40

    GAUSSIAN QUADRATURE FOR r F(x) dxThis program computes the value S:f(x) dx for finite a and singlevalued function f(x) by the six pointGauss-Legendre quadrature formula:/00 f(x) d x ~

    1 6 4 wi- L22 . 1 ( l+z.) 2( ~ + a - 1)I+zi,= ,where: ZI = -Z'2 = .238619186

    Z3 = -Z4 = .661209386Zs = -Z6 = .932469514WI = W2 = .467913935W3 = W4 = .360761573Ws = W6 = .171324492

    33 lines and 20 registers (R.o -R 29 )are available to define f(x).Reference:

    Examples:

    Applied Numerical Methods.Carnahan, Luther, andWilks, John Wiley andSons, 1969.

    a

    Solutions:8.238619186 ST018.661289386 ST028.932469514 ST038.467913935 ST048.368761573 ST058.171324492 ST06

    (;T0266 CHS67 eK68 LSTX69 CHS7871 0

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    29/40

    26

    INSTRUCTIONS INPUT KEYS OUTPUTSTEP DATA/UNITS DATA/UNITS1. Key in the program and switch to run mode. C JC J!:=J [==:J2. Store constants: 238619186 [SI[J CIJ

    ~ ~ ' ? ~ ~ I T J,932469514 5fLJ [IJ.467913935 ~ [ I J.360761573 ISTIO c:::u171324492 ~ C Dc = JC J

    3. Go to Label 2 KrriLJ CDc=Jc=J4 C:w; +rh +n nr-nnr-I'Im m n ~ o , . n ~ L-o" in ~ ( v , C ~ c = J

    V c=Jc=Jnclude a RTN statement. c::J c::J5. Switch to run mode c = JC Jc=Jc=J6. Key in a and run a iiSs=J o::::J f f ( x )c::J c::J7 For a new case. 00 to steD 3 CJCJ

    c = JC JCJc : : JCJCJc= JC Jc::J c::JCJCJc::J c::JCJCJc = JC Jc= JC Jc::J c::J[= : JCJc=J c :Jc=J c::Jc::J c=JCJc= Jc=Jc=Jc::J c::Jc= JC Jc= JC J

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    30/40

    27

    81 ,LBL8 58 RCLl82 RCL8 51 183 2 52 +84 . ***jf(X) 53 .85 R/S 54 ST0986 ,LBLl 55 RCL?87 EHIt 56 +88 1 57 bSB289 CHS 58 RCL918 ST08 Clear flag 59 .'

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    31/40

    28

    BESSEL FUNCTION J (X)

    This program computes the value ofthe Bessel function In(X) by using anumerical method which makes use ofthe recurrence relationIn_l(X) = In(X)-Jn+l(X)

    the summation relation00Jo(X) + 2.L J2i (X) = 11=1

    and the fact thatlim In(X) = 0n-xx>

    First letm = INT { 1 + 3 X l ~ + 9 x ~ + m a X ( n , x ) }

    where INT means "integer part of ".Then set

    T = amwhere a is an arbitrary non-zeroconstant.Then the series of terms, Tk,O k m,is computed by successively applyingthe relation.

    starting with k =m.In(X) is then found by dividing theterm T (X) by the normalizing constantn pK = To(X) + 2.L T2i (X)1=1

    wherep _ "2 if m is even{

    m~ 2 if m is odd

    Note that all the Tk are proportionalto a, hence K and the result are independent of a.- 6Note: Jo(X) = 1 for x ~ l O but is out

    of range for this program.Examples:

    Solutions:

    1. J o (4.7)2. J s (9.2)3. J o (1)4. J s (5)

    8. n'98888 EHTt4.78888888 r;SBl-8.269J3979 t t t5.89888880 EHTt9.2888088e CSBl-8.18852862 t t .~ . e 3 8 8 8 B 8 8 ENTt1.88988889 r;SB18.76519769 t**5.e8888888 ElITt5.n888888 r;SBl8.26114855 *u

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    32/40

    29

    INSTRUCTIONS INPUT KEYS OUTPUTSTEP DATA/UNITS DATA/UNITSl . Key in the program C J [::=J

    c = JC J2. Compute In(X) n lENT IC J

    X IGSB I[IJ J.,(X)CJCJCJCJc : : JCJCJCJCJCJc:=J c=::JCJCJC ~ C JCJCJc:=J c=::JCJCJCJCJc :=JCJc=::J c=::JCJCJCJCJc:=J c:=JCJCJCJCJc:=J c=::JCJCJc :=JCJCJCJCJCJC J c=::Jc=J c:::JCJCJCJCJc:=J c:=JCJCJCJCJCJCJc=Jc=JCJCJCJCJ

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    33/40

    30

    81 ,LBLl 58 RCLl82 STOI 51 -83 N 52 x84 ST05 53 RCL685 EEX 54 ST0386 CHS 55 x87 9 56 X:Y88 9 57 -89 ST06 58 ST0618 8 59 RCL811 ST03 68 1 Decrement count12 ST04 61 -13 RCLl Calculate m 62 GT0914 6 63 *LBL715 1/,!r; 64 ReL716 yx 65 RCL417 ENTt 66 218 EHTt 67 .:{19 9 68 RCL628 x 6g +21 x 78 *** In(X)2 LSTX 71 P.,'S23 IX 72 ,LBL824 + 73 RCL625 1 74 ST!l726 + 75 RTH27 RCL! 76 ,LBL828 RCL5 77 RCL629 X ) Y ~ 78 ST+438 X:Y 79 RTH31 RJ. MAX(n or x)32 +33 IHT34 ,LBL9 m35 ST0836 RCL537 X=Y?38 GSB839 RCL848 X = 8 ~41 GT0742 243 -44 FRC45 X=8?46 GSB847 RCLJ48 RCLS49 2 REGISTERS

    0 1 X 2 3 Tk+l 4 n?i 5 n6 _ 9 9 7 8 Counter 9 Used .0 .110 , Tv Tn k.2 .3 .4 .5 16 1718 19 20 21 22 2324 25 26 27 28 29

    *** IIPrintx ll may be inserted.

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    34/40

    GAMMA FUNCTION

    This program approximates the gammafunction r(x) for 0

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    35/40

    32

    INPUT KEYS OUTPUTSTEP INSTRUCTIONS DATA/UNITS DATA/UNITS1 Kpv ; n the D - ~ " " ' ~ - c=Jc=Jc=Jc=J2. Compute rex) x [GS[J IT] rex)c=J c:=Jc::=J C=:Jc = JC JC J [ 1c=J [ IL ~ C JCJ c= Jc = J C ~C ~ C Jc = J C ~L =:J C=--:J[-=-=:J C Jc=JC-J

    iJc=JC ~ C Jc=Jc=Jc = JC Jc=:JCJ[ ~ C Jr- ] c::::J[-=:J C JC-=JCJc = JC Jc= JC Jc= JC Jc= JC J[-=:J C Jr = l C JCJ c= Jl__ J c=J

    C - ~ c : J[ lC J[ ] c=J[ ~ C Jl ~ C J[= : JCJ

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    36/40

    33

    131 t!..BLl 58 GTOB82 STa8 "i f RCLl-" ...83 9 0;., R..S *** r (x)84 + T = x + 985 fNTt86 1..X87 X'Zee fHTt89 X'Z18 J11.12 t... j,.;" -15 316 13,.,.l i18 ,19 -28 X:'r'21 1.,., 2;;,;;2"3 x242S +26 X:Ya:.. , ENTt28 U!29 ..JB -31 ? : ~ }.,.., Pi;.,;;3334 235?-6 rg77 LfJ, I38 + In r (T)?9 CI-fS48 elf41 .STOl42 eLX4?- 9 x44 - Reduce r (T)4S tL8L846 C'T.:.f... .. ,j,47 148 + x + i x + 949 'l.1Y'J REGISTERS

    0 x 1 r(x) 2 3 4 56 7 8 9 .0 .1.2 .3 .4 .5 16 1718 19 20 21 22 2324 25 26 27 28 29

    *** "Printx" may replace "R/S".

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    37/40

    34

    SINE1 COSINE1 AND EXPONENTIAL INTEGRALS

    Sine integral:

    Si(x) = fX sin t dt =t -o00 (_l)nin + 1L (2n + 1)(2n + l)!n=o

    where x is real.This routine computes successivepartial sums of the series, stopswhen two consecutive partial sumsare equal, and displays the lastpartial sum as the answer.

    Si(x)1T"21.0

    O +- - - . - - . - - - .- - , - - , , - - .___x2 4 6 8 10 12Notes: When x is too large, computing a new term of theseries might cause an overflow. In that case, displayshows all 9's and the programstops.

    Si(-x) = -Si (x)Cosine integral:

    C (x) =y+1n x + jX cos t - 1 dt=t000 (-1) n x 2ny+ 1n x + Ln=l 2n(2n)!

    where x>O, and Y= 0.577215665 is theEuler's constant.

    This program computes successivepartial sums of the series. Whentwo consecutive partial sums are equal,the value is used as the sum of theseries.

    tiQill:

    e,(x)1.0

    -1.0

    When x is too large, computinga new term of the series mightcause an overflow. In thatcase, display shows all 9's andthe program stops.Ci(-x) = Ci(x) - in for x>O.

    Exponential integral:x tEi (x) = f dt 00 xn= Y+ 1n x + L nn!n=l0 0

    where x>O and y= 0.577215665 is Euler'sconstant.This program computes successive partialsums of the series. When two consecutive partial sums are equal, the valueis used as the sum of the series.

    Ei(x)

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    38/40

    Note: When x is too large, computinga new term of the series mightcause an overflow. In thatcase, display shows all 9'sand the program stops.References: Handbook of MathematicalFunctions, Abramowitz andStegun, National Bureauof Standards, 1968.Examples:

    1. Si (.69)2. Si (.98)3. Ci (1. 38)4. Ci (5)5. Ei (1. 59)6. Ei (.61)

    STEP INSTRUCTIONS1 Kev in the oroaram2. Store ex

    3. For Sine Inteara1For Cosine IntegralFor Exponential Integral

    Solutions:e.5??215665 sT'.e

    e.6S GSF!B. 67fl.98 GSBIfl,93 *1#:*1.38 GSB2e 1.6 . ~ : . U5,fltl t;SB2

    -8.19 : I : ~ : , :1.59 t;SB'J3.5:' H':f.8.61 t;SB?B.8@ ..

    INPUT KEYSDATA/UNITS C J C Jt:=J C J.577215665 lS.:iliJ ~ _ ICL ] [ ~L ~ C Jx []SS-J LJ_Jx [Gg[] [U2 Ix [GSB] [- l Jr -1

    35

    OUTPUTDATA/UNITS

    ex

    Si(x)Ci(x)Ei(x)

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    39/40

    36

    81 tLPU Sine Integral 58 RC.882 5T03 routine 51 +83 ,LBL984 CHS ~ RCL!85 STOt 54 RCL2

    1 55 187 5T02 56 +88 RCLJ ST02,LBL8 5818 RCL! 59 RCL? RCL2 68 )(..12 1 61 STO?12' + 62 RCL214 63

    , C''T"V 64 +-,.,':,".16 . 65 '#Y"17 + 56 ( ; r o ~18 5T02 6-' R/S1928 Rcn21 x22 STO?23 RCL22425 +26 xnn..,., (;T08.,28 R/5*** si(x)/Ci(x)29 ,LBL2

    38 Cosine Integral31 CH5 routine32 STDl33 134 5T033S 836 ST02J7 LSTX?8 LN39 RC.848 +41 '.;T0842 ,LBL343 ST01 Exponential In-44 145 STD3 tegral routine46 847 ST0248 RCU

    ~ 49 LN REGISTERS0 1 used 2 used 3 used6 7 8 9.2 .3 .4 .518 19 20 2124 25 26 27

    *** "Print X" may be used to replace "Rls".

    ***

    4.0 used162228

    Ei(x)

    5.1172329

  • 7/29/2019 HP-19C & 29C Solutions Mathematics 1977 B&W

    40/40

    In the Hewlett-Packard tradition of supporting HP programmable calculators with quality software, the followingtitles have been carefully selected to offer useful solutions to many of the most often encountered problems in yourfield of interest. These ready-made programs are provided with convenient instructions that will allow flexibility ofuseand efficient operation. We hope that these Solutions books will save your valuable time. They provide you with atool that will multiply the power of your HP-19C or HP-29C many times over in the months or years ahead.

    Mathematics SolutionsStatistics SolutionsFinancial SolutionsElectrical Engineering Solutions

    Surveying SolutionsGames

    Navigational SolutionsCivil Engineering Solutions

    Mechanical Engineering SolutionsStudent Engineering Solutions