Hi,
Is it possible to quickly modify a given matrix A so that for example, if L1
(resp. L3) represents the first line (resp. the third line) of A.
L2 <- 4/5*L2 + 2/3*L1
If it is possible, how can I do that ?
Thanks for any help,
Robert Derochette
|
|
0
|
|
|
|
Reply
|
Robert
|
7/27/2004 4:41:18 PM |
|
> L2 <- 4/5*L2 + 2/3*L1
Assuming A is a 3x3 matrix,
A = B*A should do the job if
[ 1 0 0]
B=[2/3 4/5 0]
[ 0 0 1]
Does that help?
Later,
Daniel
|
|
0
|
|
|
|
Reply
|
Daniel
|
7/27/2004 6:42:48 PM
|
|
Daniel Herring wrote:
> > L2 <- 4/5*L2 + 2/3*L1
>
> Assuming A is a 3x3 matrix,
> A = B*A should do the job if
> [ 1 0 0]
> B=[2/3 4/5 0]
> [ 0 0 1]
>
> Does that help?
>
> Later,
> Daniel
Well that doesn't seem to work whith rectangular matrixes. Well, let me
explain what I mean. In my case the matrix A represents a linear homogen
system of equations, i.e.
| 1 7 6 | 0 |
A=| -5 5 -1 | 0 |
| 0 0 0 | 0 |
The goal is finding non trivial solutions of this system. In order to do
this I must first change A to its normal form. In this case, A is obviously
of rank 2. So a should become something like
| 1 0 e1 | 0 |
A'=| 0 1 e2 | 0 |
| 0 0 0 | 0 |
So the non trivial solution would be
| e1 |
k*| e2 | , k constant
| 1 |
That's why I need to be able to do linear combinations between the lines of
a rectangular matrix. Maybe there is a built-in function to do this but the
numeric solver is *not* the way to go if you want to solve a system this
way ...
Thanks for any help
Robert Derochette
PS : (Note to Daniel Herring) Maybe your method of a left multiplication by
a square matrix should also be able to solve my problem. But then I'm too
dumb to find what elements I have to put in my matrix ;-).
|
|
0
|
|
|
|
Reply
|
Robert
|
7/28/2004 11:33:31 AM
|
|
Duh, I should use my brain before posting here. For the problem I exposed
earlier, the easy way to solve it is (if anyone interested)
| 1 7 6 |
A = | -5 5 -1 |
| 0 0 0 |
So the same matrix without the column of zeros on the right.
Now that your matrix A is on top of the stack, just do EGV. Sure the non
trivial solution of the system Ax = 0 is the eigen vector of A ... Note
that the HP49 will output a matrix containing three eigen vectors, only
consider the one with only real elements.
Robert Derochette
|
|
0
|
|
|
|
Reply
|
Robert
|
7/28/2004 1:19:54 PM
|
|
Daniel Herring wrote:
> > L2 <- 4/5*L2 + 2/3*L1
>
> Assuming A is a 3x3 matrix,
> A = B*A should do the job if
> [ 1 0 0]
> B=[2/3 4/5 0]
> [ 0 0 1]
>
> Does that help?
>
> Later,
> Daniel
I've solved my particular problem as it was in fact an eigen vectors
problem. But anyway it would be useful if I could do linear combinations
between the lines of a (not necessarily square) matrix. Any idea how I
could do that ?
Thanks
Robert Derochette
|
|
0
|
|
|
|
Reply
|
Robert
|
7/28/2004 6:51:13 PM
|
|
> ... it would be useful if I could do linear combinations
> between the lines of a (not necessarily square) matrix.
While you could write a special-purpose program to do this,
matrix-multiplication is (after some practice) more natural for linear
manipulations.
First, define the identity matrix. The identity matrix is simply full
of 0's, with 1's on the diagonal.
1x1 identity matrix:
I = [ 1 ]
2x2 identity matrix:
I = [ 1 0 ]
[ 0 1 ]
3x3 identity matrix:
[ 1 0 0 ]
I = | 0 1 0 |
[ 0 0 1 ]
On the 49G+, the NxN identity matrix may be generated by entering N on
the stack and pressing
keys "<-" "MTH" and menus "MATRX" "MAKE" "IDN".
Multiplying an NxN identity matrix by any NxM matrix will return the NxM
matrix unchanged.
(Note: Matrices are denoted by (# of rows)x(# of columns). This follows
from the convention for numbering elements.)
So for a 3x4 matrix,
[ 1 2 3 4 ]
A = | 5 6 7 8 |
[ 9 0 1 2 ]
I(3x3) * A => A
***** Row Manipulations *****
Given A is a NxM matrix, create I(NxN).
To change the i-th row of A, simply modify the i-th row of I.
The term in the j-th column of this row will multiply the j-th row of A.
Then, all these multiples will be summed together.
If I want (row) A3 = k1 A1 + k2 A2 + k3 A3, then let
[ 1 0 0 ]
B = | 0 1 0 |
[ k1 k2 k3 ]
and B * A gives the desired answer.
If you are experiencing "Invalid Dimension" errors, then you probably
have the matrices on the stack in the wrong order.
***** Column manipulations *****
Changing the columns requires only a simple modification to the above
procedure. In short, change the dimension of I and reverse the order of
multiplication.
Given A is a NxM matrix, create I(MxM).
To change the j-th column of A, simply modify the j-th column of I.
The term in the i-th row of this column will multiply the i-th column of
A. Then, all these multiples will be summed together.
If I want (column) A2 = k1 A1 + k2 A2 + k3 A3 + k4 A4, then let
[ 1 k1 0 0 ]
B = | 0 k2 0 0 |
| 0 k3 1 0 |
[ 0 k4 0 1 ]
and A * B gives the desired answer.
Hope that helps,
Daniel
|
|
0
|
|
|
|
Reply
|
Daniel
|
7/28/2004 7:42:20 PM
|
|
Robert Derochette wrote:
> Hi,
>
> Is it possible to quickly modify a given matrix A so that for example, if L1
> (resp. L3) represents the first line (resp. the third line) of A.
>
> L2 <- 4/5*L2 + 2/3*L1
>
> If it is possible, how can I do that ?
I'm not sure if the 48G series has theses commands, but the 49G has them...
use RCI and RCIJ. For your example it would be
'4/5' 2 RCI '2/3' 1 2 RCIJ
and you'll get your desired result...
Regards,
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.
|
|
0
|
|
|
|
Reply
|
Beto
|
7/28/2004 8:12:10 PM
|
|
> Hope that helps,
> Daniel
Yes it helped. Now I still need some training in order not to make stupid
mistakes, but hell yes this method is fast :). Thanks very much.
Robert Derochette
|
|
0
|
|
|
|
Reply
|
Robert
|
7/28/2004 8:38:14 PM
|
|
In article <41078f1b$0$1242$ba620e4c@news.skynet.be>,
Robert Derochette <lord_rob26@DONOTSPAMsofthome.net> wrote:
> Well that doesn't seem to work whith rectangular matrixes. Well, let me
> explain what I mean. In my case the matrix A represents a linear homogen
> system of equations, i.e.
>
> | 1 7 6 | 0 |
> A=| -5 5 -1 | 0 |
> | 0 0 0 | 0 |
>
> The goal is finding non trivial solutions of this system. In order to do
> this I must first change A to its normal form. In this case, A is obviously
> of rank 2. So a should become something like
>
> | 1 0 e1 | 0 |
> A'=| 0 1 e2 | 0 |
> | 0 0 0 | 0 |
To go from A to A' in one step, use the built in command RREF, which
returns the row reduced echelon form (rref) of a given matrix, on all
48's and 49's. On the 49's it can give exact results for an exact input
matrix.
I found that, in exact mode on my 49+,
[[ 1 7 6 0]
[ -5 5 -1 0]
[ 0 0 0 0 ]]
RREF
returned
[[ 1 0 '37/40' 0]
[ 0 1 '29/40' 0]
[ 0 0 0 0]]
Is this what you want?
|
|
0
|
|
|
|
Reply
|
Virgil
|
7/28/2004 9:34:18 PM
|
|
> RREF
>
> returned
>
> [[ 1 0 '37/40' 0]
> [ 0 1 '29/40' 0]
> [ 0 0 0 0]]
>
> Is this what you want?
Yes this also works this way. Replacing the 0 behind the '29/40' by a 1 also
gives the correct non-trivial solution of the problem
Thanks
|
|
0
|
|
|
|
Reply
|
Robert
|
7/28/2004 10:04:02 PM
|
|
Robert Derochette wrote:
>> RREF
>>
>> returned
>>
>> [[ 1 0 '37/40' 0]
>> [ 0 1 '29/40' 0]
>> [ 0 0 0 0]]
>>
>> Is this what you want?
>
> Yes this also works this way. Replacing the 0 behind the '29/40' by a 1
Errm, you must replace the 0 behind the '29/40' by a -1 and *not* a 1. I
should really relearn some basic algebra :-/.
|
|
0
|
|
|
|
Reply
|
Robert
|
7/28/2004 10:26:34 PM
|
|
Robert Derochette wrote:
> Hi,
>
> Is it possible to quickly modify a given matrix A so that for example, if L1
> (resp. L3) represents the first line (resp. the third line) of A.
>
> L2 <- 4/5*L2 + 2/3*L1
>
> If it is possible, how can I do that ?
>
There's a way..
using a small RPL program.
<< AXL -> L << 'L(2)' EVAL 4 * 5 / L(1) EVAL 2 * 3 / 'L(2)' STO L AXL >>
Jean-Yves
|
|
0
|
|
|
|
Reply
|
Jean
|
7/29/2004 5:49:09 AM
|
|
|
11 Replies
131 Views
(page loaded in 0.146 seconds)
Similiar Articles: "Multilinear" regression. - comp.soft-sys.matlabI have (noisy) data from a system, which follows some linear model ("a line") between times [a,b ... line y=kx+b with some noise added and the data vector is 2-by-n matrix ... Plot field lines of vector fields using streamslice - comp.soft ...I am getting satisfactory results with a combination of ... you can access the vector coordinates of the lines ... streamslice(X,Y,Z,Hx,Hy,Hz,[],[b],[],1,'linear ... how to plot line between any two pixels? - comp.soft-sys.matlab ...... ind = (xi-1)*m+yi; % linear ... since i wa= nt to plot a line between ... how I can plot the line between the frames, with the function 'line'. In my code I have a matrix ... Create a vector out of other two vectors - comp.soft-sys.matlab ...find unique row vectors of a matrix - comp.soft-sys.matlab ... Create a vector ... but the span of these 3 vector is only a plane because the third is a linear combination of ... hyperbolic interpolation - comp.soft-sys.matlabCreate a matrix A with rows [1 -log(x_i)] and a ... posted in Math and Physics: If I do a linear interpolation between a and ... eHow.com Curve fitting is used to lay a line that ... Plotting data with nonuniform mesh/grid? - comp.soft-sys.matlab ...Im new to Matlab and have to solve a Problem: I have a matrix with Data 354x350. ... You can use > > > > imagesc(x,y,Data) > > > > after defining your non-linear ... Matrix is close to singular or badly scaled. - comp.soft-sys ...... polynomial fitting function using the Vandermonde matrix. ... 1:1 A(:,j) = z.*A(:,j+1); end My next line is ... trouble solving system of linear equations for symbolic ... mixed models with repeated measurements - comp.soft-sys.stat.spss ...Along those lines, have you considered the ... covariate, but that assumes there is a linear relationship between ... If you determine that the CS > matrix is the way ... Interpreting cubic spline coefficients and breaks - comp.soft-sys ...... that each row of the coefficient matrix corresponded to a region between two ... 3d plot of linear splines - comp.soft-sys ... how to fit a curve with piecewise line ... Find a and b for y=ax+b - comp.soft-sys.matlab... from two sources (x,y) that are connected with a linear ... Hi, Let A and B two ... Multiple line plots, two y axes ... ... remove duplicate rows in sparse matrix - comp.soft-sys ... fast linear to log conversion algorithm? - comp.dspThe bottom line in this discovery was ... 2D interpolation with 3D matrix? - comp ... 2D vectors - comp.soft-sys ..... between subspaces are fundamental notion in linear ... Can matlab determine if a point inside a polygon? - comp.soft-sys ...... 2D convex polygon as a set of linear inequalities from %a set of vertices % % [A,b]=vert2con_special(a) % %in: % % a: Nx2 matrix ... intersection of line and polygon ... How to construct a transitive matrix from a general matrix? - comp ...... I've would like to create a matrix 1000*3 i dimension which has all the combinations ... ... up corner cases, like a matrix of only two lines of ... for something that explains linear ... how to transpose large matrix? - comp.unix.shellThe factor linear in data size enters the equation in an O(N^2) algorithm in ... I will agree that we can make up corner cases, like a matrix of only two lines of data, each ... Similarity Curves - comp.soft-sys.matlabHello, I need to compare the similarity between curves. ... but the problem is that I could have a combinations all ... said to be similar if ... complex shaped random lines ... Linear combination - Wikipedia, the free encyclopediaOr, if S is a subset of V, we may speak of a linear combination of ... of all continuous functions from the real line R to the ... Transpose; Gram–Schmidt process; Matrix decomposition Euclidean subspace - Wikipedia, the free encyclopedia4.1 Null space of a matrix; 5 Linear parametric equations ... Using this mode of thought, a line in three ... In general, a linear combination of vectors v 1, v 2, . . . , v k ... 7/24/2012 12:08:23 AM
|