How can i solve this kind of linear system



#8

Sorry for asking this kind of noob question but i'm not advanced with my 50g.

for example:

X + Y + Z = 3
X + 2Y + 3Z = 6

I did it with the NUM.SLV and the result was [1,1,1] which is correct but well I would like to get a result like [t,3-2t,t], is this possible to get it solved this was on my 50g? thanks.


#9

Greetings, I assume you mean:

X +  Y +  Z = 3
X + 2Y + 3Z = 6

and not

  X +  Y +  Z = 6
3 X + 2Y + 3Z = 6

In either case there are only two equations and three unknowns. Is there another that is not included here? It would certainly be an impressive marketing point for HP if the 50g could completely solve the above equation, given only two equations.


#10

Thanks Allen.

Of course it has to be

X +  Y +  Z = 3
X + 2Y + 3Z = 6

Well of course it couldn't be solved numerically but at least i would expect the result to be [t,3-2t,t] not [1,1,1] as given by the calculator.


#11

Compute the solution as I described in another post. Then set the calculator to exact mode and do:

SWAP OVER - XQ SWAP XQ 't' * +

and you will see what you want, except for the strange thing the calculator does with symbolic arithmetic sometimes. You'll see:

[ t  3+-2*t  t ]

If you do a swap before the last +, you'll get:

[ t  -2*t+3  t ]

which you may like better.

#12

I think he's looking for a parametric solution, whereas the 50g is just finding one of the infinitely many possible solutions.

Stefan

#13


X + Y + Z = 3
X + 2Y + 3Z = 6

As indicated, a parameteric solution would be

(x(t), y(t), z(t)) = (t, 3-2t, t)

This is an underdetermined system. From the HP-49G User's Guide, page 6-7:

Quote:
Usually there is an infinite number of solutions to these systems. The HP-49G returns the solution with the minimum Euclidean norm.

Unless enhanced functionality for linear systems was developed for the HP-50G, I'd assume that the answer of (1, 1, 1) meets the same specification. What does the manual state?

-- KS

#14

This is an interesting problem.

The solution to your problem can be written:

[ 0 3 0 ] + t*[ 1 -2 1 ]

or:

[ 1 1 1 ] + t*[ 1 -2 1 ]

That is, a particular solution vector plus some multiple of another vector. That second vector is in the null space of the coefficient matrix, meaning that the coefficient matrix times [ 1 -2 1 ] gives [ 0 0 ]. And, therefore, the coefficient matrix times any multiple of [ 1 -2 1 ] also gives [ 0 0 ]. So any multiple of [ 1 -2 1 ] can be added to a solution vector and the result is still a solution vector.

It just so happens, mirabile dictu, that the HP48G and descendants can give the solution you want. All you need to do is to find a vector in the null space of the coefficient matrix. You do this by placing the coefficient matrix on the stack and executing SVD. Three items will be returned to the stack. The second item, the V matrix, has a unit length vector in the null space as its last row. The elements of that vector aren't integers, but in this case they can be made integers by dividing the vector by its first element.

Keep in mind that it's only because this system is underdetermined that it's guaranteed to have a non-empty null space. If it were fully determined it might not have a non-empty null space.

Here's a little program (not necessarily optimized) that can do the entire job. Just put the coefficient matrix on level 2 of the stack and the column matrix on level 1 and execute PARAM.

-----------------
PARAM

<< OVER LSQ TRN ->ROW DROP SWAP DUP SIZE 2 GET
SWAP SVD ROT DROP2 SWAP ROW- SWAP DROP
DUP 1 COL- SWAP DROP / >>
------------------

Just do:

2: [[ 1 1 1 ]
[ 1 2 3 ]]

1: [[ 3 ]
[ 6 ]]

PARAM

and see:

2: [ 1. 1. 1. ]
1: [ 1. -2. 1. ]

On level 2 is a (smallest Euclidean norm) solution vector, and on level 1 is a vector in the null space of the coefficient matrix. Press - and see [ 0. 3. 0. ], the solution vector you posted. This vector plus any multiple of the vector that was on level 1 is another solution.

When you still have:

2: [ 1. 1. 1. ]
1: [ 1. -2. 1. ]

on the stack, press 7 * + and see [ 8. -13. 8 ], another solution, and so forth.

It may not always be possible to convert the last row of the V matrix (from the SVD) to a vector of integers, but even if not, it still provides the parameterized solution you want.

Try:

2: [[ 1 1 1 ]
[ 7 3 5 ]]

1: [[ 3 ]
[ 6 ]]

PARAM

and see:

2: [ -1.25 3.25 1. ]
1: [ 1. 1. -2. ]

In this case, the null space vector did convert to a vector of integers. You could enlarge the program to test if all the elements of the vector can be made integers, and if not, just keep the last row of the V matrix as it was.

Edited: 25 Nov 2007, 10:54 a.m.


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP prime: linear solver app Alberto Candel 1 1,488 11-21-2013, 01:57 AM
Last Post: Michael Carey
  HP Prime: Linear Solver app bug BruceH 0 1,194 11-15-2013, 06:36 PM
Last Post: BruceH
  XCas / Prime "solve" question Nigel J Dowrick 4 2,144 11-08-2013, 04:01 AM
Last Post: Nigel J Dowrick
  PRIME: re-format the flash drive to recover the operating system Harold A Climer 2 1,766 11-06-2013, 12:22 AM
Last Post: Michael de Estrada
  Using the Prime to solve for eigenvalues Michael de Estrada 28 8,871 10-27-2013, 07:21 AM
Last Post: Tarcisi C
  HP Prime Define: Use with solve, etc. Helge Gabert 0 1,033 10-23-2013, 06:24 PM
Last Post: Helge Gabert
  HP 34s solve f'(x)=0 Richard Berler 8 2,683 10-07-2013, 03:03 PM
Last Post: Dieter
  HP Prime Solving Nonlinear System of Equations for Complex Results Helge Gabert 11 4,400 09-30-2013, 03:44 AM
Last Post: From Hong Kong
  Good puzzle for kids to solve on 35s? snaggs 11 3,519 09-18-2013, 10:40 PM
Last Post: David Hayden
  September SOLVE Newsletter Robert Prosperi 4 1,906 09-07-2013, 01:12 AM
Last Post: Mic

Forum Jump: