[hp50g] is it possible to solve linear systems with unknown variables in it?
|
10-12-2022, 11:16 PM
Post: #1
|
|||
|
|||
[hp50g] is it possible to solve linear systems with unknown variables in it?
For example, I wanna solve the following linear system:
7x + 2Ky = 0 3Kx - 8y = 2 where K is an unknown variable. The result of the solver should be a function of K. Is it possible with hp50g? How? Thanks in advance! |
|||
10-13-2022, 08:07 AM
(This post was last modified: 10-13-2022 08:39 AM by Gjermund Skailand.)
Post: #2
|
|||
|
|||
RE: [hp50g] is it possible to solve linear systems with unknown variables in it?
Hi
(small update) Here's my take, You could solve it by using Cramer's Rule x = (DET [[ 0 2K], [2 -8]]) / (DET [[7 2K], [3K -8]] ) y = (DET [[ 7 0], [3K 2]]) / (DET [[7 2K], [3K -8]] ) rewrite it using SYST2MAT [[7x 2Ky] [ x [3Kx -8y=2]] y ] SYST2MAT then thus M [ 'x' 'y'] -> x y << SYST2MAT ->COL DROP -> C1 C2 C0 << C0 C2 2 COL-> DET C1 C2 2 COL-> DET / C1 C0 2 COL-> DET C1 C2 2 COL-> DET / >> >> which gives X = -4k/(6 K^2 + 56) Y = 14/(6 K^2 + 56) br Gjermund |
|||
10-13-2022, 08:23 AM
Post: #3
|
|||
|
|||
RE: [hp50g] is it possible to solve linear systems with unknown variables in it? | |||
10-13-2022, 08:44 AM
Post: #4
|
|||
|
|||
RE: [hp50g] is it possible to solve linear systems with unknown variables in it?
Thanks,
seems I too need to read the manual from time to time. br Gjermund |
|||
10-13-2022, 12:16 PM
Post: #5
|
|||
|
|||
RE: [hp50g] is it possible to solve linear systems with unknown variables in it? | |||
10-14-2022, 05:21 PM
Post: #6
|
|||
|
|||
RE: [hp50g] is it possible to solve linear systems with unknown variables in it?
Thanks Gjermund and Marco for the responses.
@Marco: could you give an example of how can I input an unknown variable in LINSYS command? The way I usually input a linear system is via "NUM.SLV -> Solve lin sys..." and then inputing the matrix there. However, when I try to input an undefined variable, I receive an error. What would be the correct way to do it? Thanks! |
|||
10-17-2022, 01:22 PM
Post: #7
|
|||
|
|||
RE: [hp50g] is it possible to solve linear systems with unknown variables in it?
(10-14-2022 05:21 PM)felipeek Wrote: Thanks Gjermund and Marco for the responses.I am not sure about what you are trying to do. If you refer to the system in the first message, you cannot solve it numerically but you need to use LINSOLVE, which is a CAS command and can be reached via S.SOLV (White Shift + 7). To input a variable or an expression in a matrix using Matrix Writer you shall use the symbol ', i.e. 'X' |
|||
10-17-2022, 05:32 PM
(This post was last modified: 10-17-2022 05:59 PM by ijabbott.)
Post: #8
|
|||
|
|||
RE: [hp50g] is it possible to solve linear systems with unknown variables in it?
In RPN, you can set stack level 2 to a vector containing the equations, and stack level 1 to a vector containing the variables to solve for, then use LINSOLVE (on the S.SLV menu):
Code: ['7*X+2*K*Y=0' '3*K*X-8*Y=2'] You should end up with 3 items on the stack: Code: { [ '7×X+2×K×Y=0' '3×K×X-8×Y=2' ] [ 'X' 'Y' ] } The bottom line is the answer for 'X' and 'Y' in terms of 'K'. (I'm not sure what the 'Specific' line means.) This is equivalent to Gjermund Skailand's answer. The only difference is that the unknown 'K' has opposite sign. [EDIT: Actually that means that they are not equivalent. Substituting Gjermund's result into '3kx-8y=2' results in '-2=2'. What's going on?] — Ian Abbott |
|||
10-17-2022, 06:38 PM
Post: #9
|
|||
|
|||
RE: [hp50g] is it possible to solve linear systems with unknown variables in it?
You can also divide a vector by a square matrix. Really, it multiplies by the inverse of the matrix.
1. Put the right hand side on the stack as a 2x1 matrix: Code: [[0] [2]] 2. Put the X and Y coefficients on the stack as a 2x2 matrix: Code: [[7 '2*K'] ['3*K' -8]] 3. Divide. Result is a 2x1 matrix. The first row is X, the second row is Y: Code: [[ '2*K/(3*K^2+28)' ] (I don't know why it doesn't factor out the 2 from the numerator and denominator for the 2nd row.) — Ian Abbott |
|||
10-17-2022, 11:25 PM
Post: #10
|
|||
|
|||
RE: [hp50g] is it possible to solve linear systems with unknown variables in it?
Thank you all for the responses. I tested all methods and they all work fine!
My preferred method at the moment is the last one posted by @ijabbott. I think it is easier than using LINSOLVE directly since I don't need to explicitly define that I want to solve for X and Y (in this case). Also, the output is shown in a 'prettier' way. The only thing that bothers me is that I was only able to make it work in RPN mode. I tried dividing the matrices in algebric mode, but it doesn't work even though I see the matrices are being correctly recognized (even when the matrices contain only numbers). I don't use RPN very often so for now I will mostly be tweaking modes, but I assume there must be a way to do the same in ALG mode. Do you have any hints? Thanks!! Really appreciate it. |
|||
10-18-2022, 07:43 AM
Post: #11
|
|||
|
|||
RE: [hp50g] is it possible to solve linear systems with unknown variables in it?
(10-17-2022 11:25 PM)felipeek Wrote: I don't use RPN very often so for now I will mostly be tweaking modes, but I assume there must be a way to do the same in ALG mode. Do you have any hints? You do not need the quotes in ALG mode, but do need commas between elements of a row, so this should work: Code: [[0][2]]/[[7,2*K][3*K,-8]] It works for me! — Ian Abbott |
|||
10-19-2022, 03:47 PM
Post: #12
|
|||
|
|||
RE: [hp50g] is it possible to solve linear systems with unknown variables in it?
Works like a charm @ ijabbott! Thank you!
|
|||
10-23-2022, 04:37 AM
Post: #13
|
|||
|
|||
RE: [hp50g] is it possible to solve linear systems with unknown variables in it? | |||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)