-
×InformationNeed Windows 11 help?Check documents on compatibility, FAQs, upgrade information and available fixes.
Windows 11 Support Center. -
-
×InformationNeed Windows 11 help?Check documents on compatibility, FAQs, upgrade information and available fixes.
Windows 11 Support Center. -
- HP Community
- Archived Topics
- Tablets and Mobile Devices Archive
- Re: Using a matrix with variables in it.

Create an account on the HP Community to personalize your profile and ask a question

02-02-2013 02:20 AM
Hi all, I'm new to my HP 50g so this may be easier than I'm making it look.
I'm trying to write an equation for my strength of materials class. The equation is the follow:
K = ((E*A)/L)* [ C^2 C*S -C^2 -C*S ]
[ C*S S^2 -C*S -S^2 ]
[ -C^2 -C*S C^2 C*S ]
[ -C*S -S^2 C*S S^2 ]
The matrix is a 4x4. I need to be able to assign values to E,A,L and more importantly C & S. So basically, I just need a scalar multiplied by a matrix. I can't seem to figure out how to make this work.
Would anyone be able to help me out?
I'm using RPN and CAS mode only has numeric mode checked. I'm really new to the HP 50g though so I can switch anything up just as longa s we can make this work!
Thanks!
Solved! Go to Solution.
Accepted Solutions
02-02-2013 11:44 AM
if you are going to multiply many different scalers to the matrix,
or substitute many different values of S, C, E, A, L the best way would be the following
store the original matrix (again, in this example, only using 2 rows of the original matrix)
[[ 'C^2' 'S*C' '-C^2' '-(S*C)' ]
[ 'S*C' 'S^2' '-(S*C)' '-(S^2)' ]]
'MAT'
STO
the matrix is now stored in a variable called MAT
now store the scaler
'E*A/L'
'SCAL'
STO
the scaler is stored in a variable called SCAL
now for the original equation
'SCAL*MAT'
'K'
STO
now for the first group of variables
5
'E'
STO
6
'A'
STO
7
'L'
STO
8
'S'
STO
9
'C'
STO
all variables now have assigned values
press VAR
to make sure the variables are showing on the softkeys F1 thru F6
press the softkey for K
EVAL
SIMPLIFY (or EXPAND EXPAND)
and if you want the matrix solutions in decimal press RIGHT SHIFT ->NUM (enter key)
to change any of the variable values, for example, 'L' , it is very simple.. change L to a value of 20
20 ENTER
LEFT SHIFT
softkey L (note that using left shift then softkey for the variable to be stored only works in RPL mode NOT algebraic mode)
now to re-evaluate the matrix * scaler equation
softkey K
EVAL
SIMPLIFY (or EXPAND EXPAND)
if you want to change the scaler, same process.
'L*E*A+13'
LEFT SHIFT
softkey SCAL
softkey K
EVAL
SIMPLIFY (or EXPAND EXPAND)
to make changes to the matrix...
softkey MAT
DOWN ARROW (this automatically brings the matrix into the matrix writer application)
edit the cells necessary then press enter
with the edited matrix now on stack level 1
LEFT SHIFT
softkey MAT
softkey K
EVAL
SIMPLIFY (or EXPAND EXPAND)
etc.....
02-02-2013 08:56 AM
Hi loopfish, welcom to the forum.
In RPN mode, hit left shift, MTRW to bring up the matrix writer. Key in your matrix elements (put the elements inside of apostrothies if you want to use algebraic keystrkes to enter them, otherwise you'll need to use RPN keystrokes, hitting space instead of enter). Hit enter to put the element into the matrix. After entering the last element, hit enter one more time to put the matrix onto level 1 of the stack. You can store the matrix into a variable now if you wish.
To multiply by a scalar, just put the matrix into level 2, and the scalar in level 1 and hit multiply.
To substitute values in for the alpha characters, put the matrix in level 2 and the substitution in level 1 (S=5, for instance), and execute the SUBST command (which is in pg 2 of the ALG menu). If you have a bunch of substitutions, you can put them into an array and SUBST them all at once.
Storing values into the named variables in the matrix and then hitting EVAL doesn't seem to have any affect on the variables within the matrix, which leads me to believe that the calculator may not treat the alpha characters within the matrix as normal variables. Maybe someone else can offer some insight on this.
Hope this helps you reach a solution.
Best regards, Hal
02-02-2013 09:04 AM
the easiest way to create the matrix is to use the MTRW function:
RIGHT SHIFT ' (that is the single quote key)
to enter the variable values in an individual cell in matrix writer
first push the single quote key
'C^2' ENTER
each matrix variable entry must be put in single quotes
perform this process for each variable entry in each appropriate cell to create a 4x4 matrix then press enter.
For this example, I have only entered 2 rows of the matrix problem posted .
Now, enter the scaler. Either use equation writer OR enter the equation on the stack.
since this is an easy equation, it will be entered on the stack.
press the single quote key ( ' )
'E*A/L' ENTER
the stack now looks like:
now just press the multiply key ( X )
to substitute values in for each variable use the SUBST command.
for example, enter the following on the stack.
'S=12' (use either equation writer or on the stack single quote key then S=12)
SUBST
02-02-2013 09:17 AM
@Hal bitton wrote:Storing values into the named variables in the matrix and then hitting EVAL doesn't seem to have any affect on the variables within the matrix, which leads me to believe that the calculator may not treat the alpha characters within the matrix as normal variables. Maybe someone else can offer some insight on this.
store the value into a variable.
put the matrix on level 1 of the stack
put the scaler on the stack
execute the multiply command (X)
then execute
SIMPLIFY (or EXPAND)
the substitutions will be made correctly and evaluated.
This means that if the value 4 is stored in 'C',
once SIMPLIFY is executed, where there is a variable 'C^2', the number 16 will be the replacement value and the equation will be evaluated.
however, if SUBST is used,
'C=4'
SUBST
the replaced value will appear as '4^2' where there are variables 'C^2'
execute SIMPLIFY, and the '4^2' entries will be changed to 16
(NOTE:: SIMPLIFY function will simplify C^2 differently than the equation 'E*A*C^2/L'. The AUR states the simplify command follows a specific set of rules when the function is performed; however, those rules are not defined. ... ie, if C^2 is present it will not substitute 4^2.... however, if 'E*A*C^2/L' is present, it will substitute and evaluate )
if EXPAND is used, the first execution of EXPAND will substitute '4^2' where there are variables 'C^2'
execute EXPAND a second time and the '4^2' will be converted to a value of 16, again depending on the type of equation to expand. The exact rules used by the command EXPAND are not listed in any documentation)
you will have to try both EXPAND and SIMPLIFY to see the different output created by the 50G
02-02-2013 11:38 AM
Hi!, loopfish:
Welcome, to Forum !.
See, this example ...
I define, the values of variables, and stored it's, with your names ... 'A', 'E', 'L':
A = 2
E = 4
L = 3
Then, calculate, with EVAL ...
The result, of K= 2.66666666667
Store 'K'
Now, put the matrix and 'K' in stack and multiply (x) ...
Now, then ...
or ...
With XQ function ...
Now, is assign value, for variables 'C' and 'S'
C = 6
S = 5
Now use, function AXM ...
The result, is ...
With XQ function ...
Notes:
1) Configure FLAGS ...
Exact mode must be set (flag –105 clear).
Numeric mode must not be set (flag –3 clear).
2) The function AXM ...
Converts a numeric array (object type 3) to a symbolic matrix (object type 29), or a symbolic matrix to a numeric array.
02-02-2013 11:44 AM
if you are going to multiply many different scalers to the matrix,
or substitute many different values of S, C, E, A, L the best way would be the following
store the original matrix (again, in this example, only using 2 rows of the original matrix)
[[ 'C^2' 'S*C' '-C^2' '-(S*C)' ]
[ 'S*C' 'S^2' '-(S*C)' '-(S^2)' ]]
'MAT'
STO
the matrix is now stored in a variable called MAT
now store the scaler
'E*A/L'
'SCAL'
STO
the scaler is stored in a variable called SCAL
now for the original equation
'SCAL*MAT'
'K'
STO
now for the first group of variables
5
'E'
STO
6
'A'
STO
7
'L'
STO
8
'S'
STO
9
'C'
STO
all variables now have assigned values
press VAR
to make sure the variables are showing on the softkeys F1 thru F6
press the softkey for K
EVAL
SIMPLIFY (or EXPAND EXPAND)
and if you want the matrix solutions in decimal press RIGHT SHIFT ->NUM (enter key)
to change any of the variable values, for example, 'L' , it is very simple.. change L to a value of 20
20 ENTER
LEFT SHIFT
softkey L (note that using left shift then softkey for the variable to be stored only works in RPL mode NOT algebraic mode)
now to re-evaluate the matrix * scaler equation
softkey K
EVAL
SIMPLIFY (or EXPAND EXPAND)
if you want to change the scaler, same process.
'L*E*A+13'
LEFT SHIFT
softkey SCAL
softkey K
EVAL
SIMPLIFY (or EXPAND EXPAND)
to make changes to the matrix...
softkey MAT
DOWN ARROW (this automatically brings the matrix into the matrix writer application)
edit the cells necessary then press enter
with the edited matrix now on stack level 1
LEFT SHIFT
softkey MAT
softkey K
EVAL
SIMPLIFY (or EXPAND EXPAND)
etc.....
02-02-2013 02:18 PM
One other question, is there an easier way to enter the value of the variables? When I go into the equation solver it prompts me for the E,A, and L values but doesn't ask for C and S. any way of doing this? My friend Ti89 allows him basically setup the input commands for all the variables in the equation so must be something in the HP?
02-02-2013 04:38 PM
@loopfish wrote:
These were great solutions guys thanks!
One other question, is there an easier way to enter the value of the variables? When I go into the equation solver it prompts me for the E,A, and L values but doesn't ask for C and S. any way of doing this? My friend Ti89 allows him basically setup the input commands for all the variables in the equation so must be something in the HP?
for any computer or calculator, there is no better way to store variables than
value
variable name
store.....
if you plan on performing many of these types of problems, write a very simple program that you can modify to add or subtract variables at will..
such as:
%%HP: T(3)A(R)F(.);
\<<
"MATRIX CALCULATIONS"
{ { "E:" } { "A:" } {
"L:" } { "C:" } {
"S:" } } 2 { } { }
INFORM NOT { KILL }
IFT { E A L C S } DUP
PURGE STO MAT SCAL *
SIMPLIFY
\>>
copy and past the above program to a NOTEPAD file.
then use the connectivity software to transfer the file to your calculator in ASCII transfer mode.
in essence, the program is the additional use of 3 new commands.... the INFORM command to input the variable values. An IFT command to test to make sure that CANCEL was not selected during the inform input. PURGE to delete the list of values/variables previously used....
then the program executes what what you have already been doing....
the program STOres the new variables entered
then the program executes the known equation....
MAT
SCAL
*
SIMPLIFY
This basic program should take little/no effort to add/remove variables from the INFORM command and PURGE/STORE list or change the equation for other calculations.
NOTE:: put the program in the same directory wher the matrix and scaler equations are stored
02-02-2013 08:29 PM
Hi!, loopfish:
Is very easy. In my previous post and with the example, you can use good idea, in the equation, for put and store 'S' and 'C' variables.
Note: You can use, any operation (+ or - ), for second operating (S*C*0).
