background image

7 Using the Solver

Unfortunately the HP-42S does not have an equation editor like the 33S one. To use the solver and
numeric integration we must enter the equation in a program which must have a global name.

Let's suppose we want to solve the equation 

x

2

5

x

4

=

0 . We are going to enter it in a

program. For example:

01 LBL “FX”   (“FX” is the global name of the program)
02 MVAR “X” (You find this in Solver menu. I will explain this later) 
03 RCL “X”
04 X↑2
05 5
06 RCL “X”
07 x
08 -
09 4
10 +
11 END

Well, as you can see we don't enter the equation f(x)=0 but just the function f(x). The MVAR
function tells the calculator what variables must appear in the solver menu. We suppose all
variables are in the memory so we use RCL function.

Now we leave the program mode and we go to the Solver menu. What should appear is

Select Solve Program

Then in our case we select FX and we give a start value, for example 8 and we press X to enter this
value. Again we press X to calculate the correct value of x which give to us X=4.

But this equation does not have only one solution. X=1 is also a solution. To get it we can enter 2
for example for the start value.

If you want to solve numerically many equations of the form 

a x

2

bx

c

=

0  you can write a

program such as

01 LBL “FX”
02 MVAR “A”
03 MVAR “B”
04 MVAR “C”
05 MVAR “X”
06 RCL “X”
07  X↑2
08 RCL “A”
09 x
10 RCL “B”
11 RCL “X”
12 x
13 +
14 RCL “C'

Summary of Contents for Free42

Page 1: ...An alternative HP 42S Free42 Manual Version 0 6 2005 Author José Lauro Strapasson Brazil jlstrapasson uol com br http joselauro com 42s pdf ...

Page 2: ...Index 1 Introduction 2 Basic Operations 3 Memory 4 Probability 5 Complex numbers 6 Programming 7 Using the Solver 8 Numeric Integration 9 Statistics 10 Matrices 11 Other Bases 12 Flags License for this manual ...

Page 3: ...also had some graphing abilities but was pocketed sized and non RPL some people as me like RPN but dislike RPL It is important to say that this manual is not complete and I don t want it to be Two things I really don t want to see here are PRINTING and HP 41 compatibility This because I suppose most owners don t have the printer and it is not so useful and also haven t had a HP 41 prior to HP 42S ...

Page 4: ...2x79 In a RPN calculator we do 2 ENTER 79 x 4 But how one could do this in an algebraic calculator If the calculator has the and sings it is just do 4 2 x 79 But if there are no we do this in a good calculator by doing 4 2 x 79 By a good calculator we mean a calculator which knows that x and are prior to and In a bad algebraic calculator which does not know this we have to do 2 x 79 and 4 or 2 x 7...

Page 5: ...rn ON OFF To turn your HP 42 on press ON The ON key is the same EXIT key To turn your HP 42S off press OFF OFF is in the same key of EXIT and ON and by OFF we mean you have to press the orange key before press the EXIT keywhich have OFF in orange above The orange key is what in some other calculators is called second function When you press this all keys turn in what is written in orange above it ...

Page 6: ...s with all menus 2 6 1 The FIX function The FIX function is not a function in the mathematical sense but a calculator function By using FIX function the display becomes with a fixed number of digits after decimal point Ok press FIX I mean with DISP menu active When you do this what appears is FIX _ _ Then you have to enter a number up to 11 Example FIX 0 4 set calculator to have 4 digits of precis...

Page 7: ...le Exercise Show that 1 0001 1 gives 1 000E 4 in FIX 3 mode Answer First we put the calculator in FIX 3 mode by doing DISP FIX 0 3 Then we do 1 0 0 0 1 ENTER 1 and we get the answer As you can see when you are in FIX mode a sign appears on the right side of FIX name in the DISP menu This means FIX mode is active The same happens with SCI ALL etc It is out of our scope to give a full description of...

Page 8: ...In algebraic calculators the are limited to a given number depending on the model The same happens in RPN calculators In some models like HP 48 or HP 49 the amount of input data is limited only by available memory But in other models like 32SII 33S in RPN mode and 42S the input data have to fit in a stack of four lines There are four lines labeled x y z and t actually the name of the last two is n...

Page 9: ...s the stack rolls down line y goes to line x line x goes to line t line t goes to line z and line z goes to line y In the CLEAR Menu there are some interesting functions CLST which clears all the stack something missing in HP 33S CLX clears the line x in the same way of pressing The is more used to correct a number when typing it Another useful function is LASTx which gives the last calculated res...

Page 10: ...e 300 plus 10 you do 300 ENTER 10 R and π We already discuss these The first rows down the stack and the other returns π 3 14 SIN and ASIN These are the sinus trigonometric function and its inverse The angle type is set up as said before in MODES menu The default is degrees ASIN is the inverse usually called arcsine or sometimes sin 1 don t confuse with cosec which is 1 sin It is important to reme...

Page 11: ...EQ SINH calculates the hyperbolic sinus while XEQ OFF turns the calculator off Finally we must say that ALPHA is not always needed In some cases like XEQ GTO we will see this later a simple ENTER will do x y and LASTx We already talked about This just change the sign of a number E and DISP We already talked about DISP menu but what would be E The E is the character meaning the power of 10 in scien...

Page 12: ... the number in R05 2 STO 1 0 divides the number in R10 by 2 You can also use RCL RCL RCLx RCL but it is not so fun This gives the result of the calculation but does not change the number in the memory If 25 positions in the memory is not enough for you you can change this number by using SIZE function which is in the second line of MODES menu For example MODES SIZE 0 1 0 0 changes to have 100 posi...

Page 13: ...he CATALOG menu The CATALOG menu has the following submenus FCN PGM REAL CPX MAT MEM FCN It shows all the functions available in HP 42S calculator It has many lines and one must use the and to navigate through the lines Here you are going to find important functions we don t see in the keyboard including hyperbolic functions SINH COSH etc functions to work with integer and real numbers like IP int...

Page 14: ...ons so press FCN Now you find the function you want and then you press the position you want it appears in the CUSTOM menu Example Let s put ABS absolute value in the first position of CUSTOM menu ASSIGN FCN ABS In the display you are going to see ASSIGN ABS TO _ Then you pick a position for example if you have and you press the first your CUSTOM menu will become ABS As you can see the CUSTOM menu...

Page 15: ...ng cannot appear more than one time but now the order matters Example Five cars are in a race Their colors are red blue green white and cyan What are the possible results Solution For the first position we have five possibilities For the second position we have four possibilities and three possibilities for the third position So we have 5x4x3 60 different arrangements To see this using 42S just en...

Page 16: ...only one function for both things RAN This is the random number generator which gives a pseudo random number in 0 x 1 SEED A sequence of pseudo random numbers always starts with a seed If you repeat the seed the sequence repeats To enter a new seed just enter a number and press SEED If the seed is zero the calculator will generate another seed ...

Page 17: ...lex number y ix Again unlike HP 33S almost all functions of HP 42S fully support complex numbers Example Show that i 2 is 1 Solution 0 ENTER 1 COMPLEX x 2 which gives 1 0000 i0 0000 means 1 5 2 Complex numbers in polar coordinates When representing a point in R 2 we can use any kind of coordinate system The most more used are the rectangular or Cartesian system which use the usual coordinates x an...

Page 18: ...or this kind of equation is x b 2a where b 2 4ac Let s suppose a b and c are in R00 R01 and R02 respectively and we are going to use R03 for To solve this equation using HP 42S Free42 we just do RCL 01 This is b x 2 4 RCL 00 This is a RCL 02 This is c keep in mind we have only four lines in the stack x x STO 03 This is Unlike some other models say 33S we don t need to worry with is negative But we...

Page 19: ...rs Now let s enter the second part of the program which gives to us the first root if you used the cursors you must go back where you stopped After doing so we have 17 x 18 Again in the display the functions are not exactly as we know and x appears as SQRT Unless we store the result in a memory we must find a way to stop the program to see the result This is doing by the function STOP which is ent...

Page 20: ...l make the program to jump to that label But what is a label A label is a name we give to a position in the program using the LBL command which is available in PGN FCN it means program functions menu To create a label you must be in the programing mode PRGM and then just press LBL and then enter a name 1 to 7 letters If you use only one letter you are not going to have the and the label won t appe...

Page 21: ...uction like what we have in computer s programming languages like BASIC Pascal or C In fact there is no IF THEN ELSE ELSEIF etc in the HP 42S programming language but there are 12 test functions which are X 0 X 0 X 0 X 0 X 0 X 0 and X Y X Y X Y X Y X Y X Y The first group of functions involving the number 0 is accessed by the X 0 sub menu which is available in the second line of the PGN FCN menu T...

Page 22: ...ber the bigger the time the program will spend The Emu42 program yes I use it too in my laptop using Authentic Calculator Speed option takes about 37s for the number 1000 Without this option or using Free42 is too much faster 6 4 Real program examples Here is one of my favorite programs It just see if a number is prime With a small change works in 33S too 01 LBL PRIME 02 STO 00 03 2 04 STO 01 05 M...

Page 23: ...nction tells the calculator what variables must appear in the solver menu We suppose all variables are in the memory so we use RCL function Now we leave the program mode and we go to the Solver menu What should appear is Select Solve Program Then in our case we select FX and we give a start value for example 8 and we press X to enter this value Again we press X to calculate the correct value of x ...

Page 24: ...fic variable say X of course we can find any missing variable 5 We don t need to use the solver only for complex hard to find solution equations We can use the solver just to automate some easy calculations Example Consider the ideal gas equation PV nRT where R is 8 3144472 J mol K We can write a program like 01 LBL GAS 02 MVAR P 03 MVAR V 04 MVAR N 05 MVAR T 06 RCL P 07 RCL V 08 x 09 RCL N 10 RCL...

Page 25: ... END Then we go to the f x menu and what we have is Select f x Program In our case we select FX then what appears is Set Vars Select var and we select X before that we may set some variables constants if needed and then we have to set LLIM lower limit ULIM upper limit and ACC Accuracy factor In our case 0 LLIM and 1 ULIM and for ACC we can use 0 001 Now just press and we find 0 33333028 If we set ...

Page 26: ...late the mean add it to statistical data and then press SDEV CFIT This is a sub menu to fit the data in linear regression logarithm regression exponential regression or power regression There is also a second line with ALL LINΣ ΣREG and ΣRG Functions Example A particle of mass m1 1kg is at the position x1 2m while a particle of mass m2 3kg is at position x2 6m What is the position of the center of...

Page 27: ...esult Of course if you have only two data the calculator will find LINF to best model and the correlation coefficient will be 1 which does not mean the estimation will be good 9 2 The second line ALLΣ LINΣ ΣREG and ΣRG Functions Unlike HP 33S which has special variables for statistic the HP 42S uses the normal Rnn memories from R11 to R23 in the following way R11 for Σx R12 for Σx2 R13 for Σy R14 ...

Page 28: ...lumns TRAN Calculates the transposition of a matrix The transpost is another matrix with rows changed by columns If A is a matrix nxm and aij is an element of it then its transpost will be a matrix B where an element bij aji SIMQ Means Simultaneous Equations We are not going to see this here EDIT This edits a matrix in line x of the stack It has the following sub items In the first line we have OL...

Page 29: ...nt from a calculation Talking about matrix calculation the HP 42S does x and of matrices in normal way Of course as you know the operations are not always possible For example To sum or subtract matrices they must have the same size etc How can one use matrices to solve linear systems The HP 42S owner s manual explains it by using the SIMQ function But it would be more profitable to remember a lit...

Page 30: ... a matrix But if you want to calculate the dot product in the calculator you can use DOT function As you know if we have two vectors A and B the dot product is AxBx AyBy AzBz If the number of dimensions is not 3 but N we calculate the dot product in the same way as A1 B1 AN BN You probably won t use this because it is faster to do by hand We spend a lot of time just to enter the vector in the calc...

Page 31: ...nctions A F Select hexadecimal mode and show A to F HEXM Select hexadecimal mode DECM Decimal mode OCTM Octal mode BINM Binary mode LOGIC Show the logic functions AND OR XOR NOT BIT ROTXY Example How do we write 500 in hexadecimal mode Solution In decimal mode enter 500 and then select HEXM You will find 1F4 ...

Page 32: ...dy some of the flags 00 to 10 and 81 to 99 These 30 flags are not related to the calculators status but are just binary memories you can use for what you want 11 When you turn on the calculator if the flag 11 is set the calculator runs the program where the calculator s pointer is stopped and clears the flag 11 24 If this flag is set the calculator will ignorate error messages Out of Range will ap...

Page 33: ...005 Author José Lauro Strapasson Brazil LICENSE This manual is available as is without any warranty It can be printed put in web sites to download freely used etc but cannot be translated or changed without author s permission except for personal use ...

Reviews: