Jump to content



Photo
- - - - -

Solve A Matrix


  • Please log in to reply
9 replies to this topic

#1 lalong

lalong

    Newbie

  • Members
  • Pip
  • 6 posts

  • Calculators:
    Casio Classpad 300plus

Posted 14 November 2005 - 09:28 PM

Good evening!

Sorry, but i tried to solve a matrix function like the way someone has posted here before, but it wont work
Here is my data:

1) a matrix, called A, written in 2D like that:

1 2 3
3 4 6->A
2 3 2

accepted..

2) a vector (single column matrix) called B, written in 2D like that:

x
y->B
z

accepted..

now i can multiply and make basic operations on both like A*B->D or something else...

3) a "solving" matrix, which is righthanded to the equal-symbol, single column, called C; like that:

12
6 ->C
0

4) now i want to solve this like that: A*B=C

my idea was:

solve({A,C},{x,y,z})

but it doesnt work...

Help please!

Edited by lalong, 14 November 2005 - 09:29 PM.


#2 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 15 November 2005 - 08:28 AM

4) now i want to solve this like that: A*B=C
my idea was:
solve({A,C},{x,y,z})
but it doesnt work...
Help please!

solve doesn't work because it expects lists as its arguments. However, there are many ways to solve a system of linear equations:
The simplest way is to multiply the inverse of A with C:
A^-1 * C
If you really want to use solve, you must convert your system to a list of equations first. Typing
trn[x,y,z]=>X
matToList(A*X-C,1)=>syst
will create a list of equations. Now, normally you could solve the system by typing
solve(syst,matToList(X,1))
but solve returns "Wrong argument type", since their arguments must be lists; variables equal to lists are not accepted (this is a known serious limitation). So if you want to use solve, you must substitute syst and matToList(X,1) by their equivalent lists, as printed in the output. As you can see, it is possible to use the function solve for systems of linear equations, but it is not convenient at all.

you can use a funtion called rref that solves the ecuation i thing it uses the gaus jordan methoth because it returns the answer and the indentiti matrix, you cant see it at the classpad manual is very easy to use...

Well, it is possible to solve the system this way, although it is not the simplest way to proceed, plus I don't think that it helps our friend too much. Nevertheless, since you mentioned it, and you don't give details, here is how to use rref to solve a system: Augment the matrix A by a column equal to C, compute the reduced row echelon form, then extract the last column, which is the solution. All this can be done in one expression:
subMat(rref(augment(A,C)),1,4)
The main disadvantage is that the number "4" in the above expression is valid for a 3 x 3 system only. In general, this number should be replaced by n+1 for a n x n system. You can avoid this by using the alternate (and more complex) expressions
rref(augment(A,C))=>Aug
subMat(Aug,1,colDim(Aug))
You can, of course, avoid to write two expressions:
subMat(rref(augment(A,C)),1,colDim(rref(augment(A,C))))
but this is more time-consuming, since rref(augment(A,C)) is computed twice. As you can see, using rref it is not the simplest way to proceed.
I can also post other ways to solve the system, e.g., using LU or QR decompositions, but is there any sense to proceed this way?

General conclusion: If you need to solve a system of linear equations, multiply the inverse of the matrix A with the constants-matrix C. It's definitely simplest than any alternative.

#3 lalong

lalong

    Newbie

  • Members
  • Pip
  • 6 posts

  • Calculators:
    Casio Classpad 300plus

Posted 15 November 2005 - 11:39 AM

General conclusion: If you need to solve a system of linear equations, multiply the inverse of the matrix A with the constants-matrix C. It's definitely simplest than any alternative.


Yeah, thankx! the conclusion made my day..
but why isn?t there a simple mSolve-function for a matrix?

See also my post referring complex graph drawing: why do i buy an expensive calc which isn?t able to draw a simple graph that is written as complex expression.. ok, now i knew a long term way, but there is no simple way to do that

is there a chance to include these missing functions in the next OS update?

#4 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 15 November 2005 - 12:44 PM

but why isn?t there a simple mSolve-function for a matrix?
See also my post referring complex graph drawing: why do i buy an expensive calc which isn?t able to draw a simple graph that is written as complex expression.. ok, now i knew a long term way, but there is no simple way to do that

Maybe I was misunderstood. I'm not a ClassPad developer, I'm just a CP owner like you. I don't know why there are no functions like those you asked for. Furthermore, I don't think that the lack of functions such as "mSolve" is really important. I think that there are other things, much more important, that are missing.

is there a chance to include these missing functions in the next OS update?

I really don't know. What I know for sure is that OS releases so far weren't serious upgrades; only minor things have been added or improved.

#5 Overlord

Overlord

    Casio Technician

  • Moderator
  • PipPipPipPipPipPip
  • 355 posts
  • Gender:Male
  • Location:Brussels - Belgium
  • Interests:Math Researcher

  • Calculators:
    My head - C300 OS 3.00 - G100 Rom 1.02 - G65 - G60 - G25

Posted 15 November 2005 - 09:57 PM

colDim(rref(augment(A,C))) = 1+colDim(A)

you don't need to compute rref twice since you know the dim of the matrix A (colDim(A)) and that C is a column vector, and rref doesn't change the dimensions :)

#6 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 15 November 2005 - 10:31 PM

you don't need to compute rref twice since you know the dim of the matrix A (colDim(A)) and that C is a column vector, and rref doesn't change the dimensions :)

Good point; I was in a hurry when posting, so I didn't noticed it. If we really-really want to use rref desparately, we can "simply" write
subMat(rref(augment(A,C)),1,colDim(A)+1)
But the fact remains: A^-1 * C is the simpler way to solve the system of linear equations in matricial form ;).

#7 fiberoptik

fiberoptik

    Casio Addict

  • Members
  • PipPipPip
  • 70 posts

  • Calculators:
    ClassPad 300, FX-850P, FX-7700G, Voyage 200

Posted 17 November 2005 - 08:26 AM

Hello people,
PAP, you say, and i agree with you, that the simplest way to solve a system is A^-1 * C, but there is a little problem. Not all matrixes have inverse, as you know, if the Determinant of a given matrix is 0, that matrix doesn't have inverse.

regards

fiberoptik

#8 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 17 November 2005 - 11:30 AM

PAP, you say, and i agree with you, that the simplest way to solve a system is A^-1 * C, but there is a little problem. Not all matrixes have inverse, as you know, if the Determinant of a given matrix is 0, that matrix doesn't have inverse.

As you know, in non-homogeneous linear systems (the usual case), if the determinant is zero and the coefficient matrix has no inverse, then there is no unique solution. The system may have infinite solutions, or no solution at all. So, in these special cases you need to use the usual "solve" function. However, if the system is homogeneous, the situation is different...

#9 fiberoptik

fiberoptik

    Casio Addict

  • Members
  • PipPipPip
  • 70 posts

  • Calculators:
    ClassPad 300, FX-850P, FX-7700G, Voyage 200

Posted 17 November 2005 - 02:43 PM

You are totally correct (as always). My post was only a add-on to yours...
Are you a math teacher or something like that ? Your language suggest so...

Regards

fiberoptik

#10 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 17 November 2005 - 11:45 PM

Are you a math teacher or something like that ? Your language suggest so...

Well, yes and no, that is ;).




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users