 |
|
List Archives > 
Mathcad List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[mathcad] RE: How to fill a column of a matrix?
| [mathcad] RE: How to fill a column of a matrix? |
|
Author: Oakley, Philip SELEX UK
Posted: Tue, 17 Jan 2006 16:08:04 +0000
|
Ultra easy (once you know how! ;)
if a=3x3, b=3x1 matrix/vector
a<1>:=b [i.e. type" a ctrl-6 1 : b enter"]
This assigns b to column 1 of a
Philip
From: Marc Artzrouni "mailto:marc.artzrouni"
Sent: 17 January 2006 13:52
To: Mathcad Discussion List
Subject: [mathcad] How to fill a column of a matrix?
*** WARNING ***
This mail has originated outside your organization,
either from an external partner or the Global Internet.
Keep this in mind if you answer this message.
MathCad has several clever "vectorization-type" capabilities - but
there is one simple thing I can't find. Suppose
I have a 3 by 3 matrix A and I want to put in the second column some
other column vector V. how can I do that
in one fell swoop without having to write a silly loop? "Augment" and
"stack" don't help. It would be something like the submatrix function,
except that submatrix works only to extract a submatrix - not to write
into one. Using the same idea as submatrix
one could imagine a "submatrixin" function like
submatrixin(A, 1,3,2,2) = V that would put V in the second
col of A.
Could there be something like that in recent versions that I don't have
in MathCad2001i?
Many thanks
Marc Artzrouni
--
Marc Artzrouni
Département de Mathématiques (IPRA)
Université de Pau - BP 1155
64013 Pau Cedex
FRANCE
Home page/page perso:
http://www.univ-pau.fr/~artzroun/
**********************************
tel: + 33 - (0)5 59 40 75 50
fax: + 33 - (0)5 59 40 75 55
e-mail: "marc.artzrouni"
**********************************
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
|
| [mathcad] Re: How to fill a column of a matrix? |
|
Author: Stuart Bruff
Posted: Tue, 17 Jan 2006 21:02:44 -0000
|
Marc,
Use the column operator (ctl-6). This should work in 2001.
Stuart
From: "Marc Artzrouni" "marc.artzrouni"
To: "Mathcad Discussion List" "mathcad"
Sent: Tuesday, January 17, 2006 1:52 PM
Subject: [mathcad] How to fill a column of a matrix?
> MathCad has several clever "vectorization-type" capabilities - but there
> is one simple thing I can't find. Suppose
> I have a 3 by 3 matrix A and I want to put in the second column some
> other column vector V. how can I do that in one fell swoop without
> having to write a silly loop? "Augment" and "stack" don't help. It would
> be something like the submatrix function, except that submatrix works
> only to extract a submatrix - not to write into one. Using the same
> idea as submatrix one could imagine a "submatrixin" function like
> submatrixin(A, 1,3,2,2) = V that would put V in the second col
> of A.
|
|
Attachments:
Test - Column Operator 01.mcd
|
| [mathcad] Re: How to fill a column of a matrix? |
|
Author: William J Marshall
Posted: Tue, 17 Jan 2006 10:30:54 -0500
|
What's wrong with A<1> := V ?
Marc Artzrouni
<marc.artzrouni@u
niv-pau.fr> To
Mathcad Discussion List
01/17/2006 08:52 "mathcad"
AM cc
Subject
Please respond to [mathcad] How to fill a column of
"mathcad" a matrix?
ptscience.com
MathCad has several clever "vectorization-type" capabilities - but
there is one simple thing I can't find. Suppose
I have a 3 by 3 matrix A and I want to put in the second column some
other column vector V. how can I do that
in one fell swoop without having to write a silly loop? "Augment" and
"stack" don't help. It would be something like the submatrix function,
except that submatrix works only to extract a submatrix - not to write
into one. Using the same idea as submatrix
one could imagine a "submatrixin" function like
submatrixin(A, 1,3,2,2) = V that would put V in the second
col of A.
Could there be something like that in recent versions that I don't have
in MathCad2001i?
Many thanks
Marc Artzrouni
--
Marc Artzrouni
Département de Mathématiques (IPRA)
Université de Pau - BP 1155
64013 Pau Cedex
FRANCE
Home page/page perso:
http://www.univ-pau.fr/~artzroun/
**********************************
tel: + 33 - (0)5 59 40 75 50
fax: + 33 - (0)5 59 40 75 55
e-mail: "marc.artzrouni"
**********************************
|
| [mathcad] RE: How to fill a column of a matrix? |
|
Author: Pergande, Albert N
Posted: Tue, 17 Jan 2006 10:16:20 -0500
|
I'd make a loop from 0 to rows-1, and write A[col, I := data[I
You've hit on the problem that makes arrays of arrays useless in faking multidimensional arrays - you can't replace a single element inside that structure...
Al Pergande
Senior Radar Engineer
Lockheed Martin Missiles and Fire Control
MP 200
5600 Sandlake Road
Orlando, Fl 32819
Voice 407-356-5169
Fax 407-356-0933
"albert.n.pergande"
for personal mail - "al"
From: Marc Artzrouni "mailto:marc.artzrouni"
Sent: Tuesday, January 17, 2006 8:52 AM
To: Mathcad Discussion List
Subject: [mathcad] How to fill a column of a matrix?
MathCad has several clever "vectorization-type" capabilities - but there is one simple thing I can't find. Suppose I have a 3 by 3 matrix A and I want to put in the second column some other column vector V. how can I do that in one fell swoop without having to write a silly loop? "Augment" and "stack" don't help. It would be something like the submatrix function, except that submatrix works only to extract a submatrix - not to write into one. Using the same idea as submatrix one could imagine a "submatrixin" function like
submatrixin(A, 1,3,2,2) = V that would put V in the second
col of A.
Could there be something like that in recent versions that I don't have in MathCad2001i?
Many thanks
Marc Artzrouni
--
Marc Artzrouni
Département de Mathématiques (IPRA)
Université de Pau - BP 1155
64013 Pau Cedex
FRANCE
Home page/page perso:
http://www.univ-pau.fr/~artzroun/
**********************************
tel: + 33 - (0)5 59 40 75 50
fax: + 33 - (0)5 59 40 75 55
e-mail: "marc.artzrouni"
**********************************
|
| [mathcad] Re: How to fill a column of a matrix? |
|
Author: Andy Spragg
Posted: Tue, 17 Jan 2006 16:20:12 +0000
|
Unless I misunderstand the question .... Ctrl-6 inserts a column index
placeholder (angle brackets). Been there since v6 (the version at which
when I started using Mathcad). So define A, then use Ctrl-6 to say A<2> =
V. Andy
Marc Artzrouni "marc.artzrouni"
17/01/2006 13:52
Please respond to
"mathcad"
To
Mathcad Discussion List "mathcad"
cc
Subject
[mathcad] How to fill a column of a matrix?
MathCad has several clever "vectorization-type" capabilities - but
there is one simple thing I can't find. Suppose
I have a 3 by 3 matrix A and I want to put in the second column some
other column vector V. how can I do that
in one fell swoop without having to write a silly loop? "Augment" and
"stack" don't help. It would be something like the submatrix function,
except that submatrix works only to extract a submatrix - not to write
into one. Using the same idea as submatrix
one could imagine a "submatrixin" function like
submatrixin(A, 1,3,2,2) = V that would put V in the second
col of A.
Could there be something like that in recent versions that I don't have
in MathCad2001i?
Many thanks
Marc Artzrouni
--
Marc Artzrouni
Département de Mathématiques (IPRA)
Université de Pau - BP 1155
64013 Pau Cedex
FRANCE
Home page/page perso:
http://www.univ-pau.fr/~artzroun/
**********************************
tel: + 33 - (0)5 59 40 75 50
fax: + 33 - (0)5 59 40 75 55
e-mail: "marc.artzrouni"
**********************************
****************************************************************
Any opinions expressed in this email are those of the individual and not necessarily of RHM plc and/or any of its subsidiaries.
This email and any files transmitted with it are private, may be confidential and are for the intended recipient only. If you are not the intended recipient, be advised that you have received them in error. Please notify the sender of the error, delete all copies of them from your system and destroy any printed copies.
If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this email and any files transmitted with it.
Please rely on your own anti-virus system. No responsibility is taken by RHM plc and/or any of its subsidiaries for any damage arising out of any bug or virus infection.
****************************************************************
|
| [mathcad] RE: How to fill a column of a matrix? |
|
Author: Bill Brady
Posted: Tue, 17 Jan 2006 13:13:33 -0500
|
Why not A^[4]:= A^[3], A^[3]:=A^[2], A^[2]:=V?
________________________________
From: Marc Artzrouni "mailto:marc.artzrouni"
Sent: Tue 1/17/2006 8:52 AM
To: Mathcad Discussion List
Subject: [mathcad] How to fill a column of a matrix?
MathCad has several clever "vectorization-type" capabilities - but
there is one simple thing I can't find. Suppose
I have a 3 by 3 matrix A and I want to put in the second column some
other column vector V. how can I do that
in one fell swoop without having to write a silly loop? "Augment" and
"stack" don't help. It would be something like the submatrix function,
except that submatrix works only to extract a submatrix - not to write
into one. Using the same idea as submatrix
one could imagine a "submatrixin" function like
submatrixin(A, 1,3,2,2) = V that would put V in the second
col of A.
Could there be something like that in recent versions that I don't have
in MathCad2001i?
Many thanks
Marc Artzrouni
--
Marc Artzrouni
Département de Mathématiques (IPRA)
Université de Pau - BP 1155
64013 Pau Cedex
FRANCE
Home page/page perso:
http://www.univ-pau.fr/~artzroun/
**********************************
tel: + 33 - (0)5 59 40 75 50
fax: + 33 - (0)5 59 40 75 55
e-mail: "marc.artzrouni"
**********************************
|
| [mathcad] RE: How to fill a column of a matrix? |
|
Author: Marc Artzrouni
Posted: Wed, 18 Jan 2006 12:44:11 +0100
|
Many thanks to all those who suggested using the column operator - and
that works just fine for a whole column. My problem
is in fact a bit more general . I want to be able to fill any m by n
rectangular subset of a matrix A with a matrix M of dimension m by n.
So I really want a function submatrixin (inspired by the existing
"submatrix") :
A1=submatrixin(A,r1,r2,col1, col2, M) that creates a replica A1
of A and replaces row r1 to row r2 and column col1 to col2 of A with M
. Of course the dimensions have
to be right ; if M has m rows and n columns then r2-r1+1 must be m and
col1-col2+1 must be n.
The obvious answer if no such function exists is to write it myself - it
will take all of 3 or 4 lines.
It could be in a special "myfunctions.mcd" file
with other generic "personnalized" functions that I can have easy access
to by adding a "reference" to myfunctions.mcd in any worksheet
in which I would need submatrixin. No doubt that's routine for all the
MathCad experts out there.
I suspect though that a "built-in" function would do the job a lot
faster and better than my own function -
particularly if the program has to go get the function in another
file ! !
Marc Artzrouni
Marc Artzrouni
Département de Mathématiques (IPRA)
Université de Pau - BP 1155
64013 Pau Cedex
FRANCE
Home page/page perso:
http://www.univ-pau.fr/~artzroun/
**********************************
tel: + 33 - (0)5 59 40 75 50
fax: + 33 - (0)5 59 40 75 55
e-mail: "marc.artzrouni"
**********************************
|
Previous by date: [mathcad] Re: DSP method, Quang-Viet Nguyen
Next by date: [mathcad] Re: How to fill a column of a matrix?, Stuart Bruff
Previous thread: [mathcad] Re: Help with creating a vector, Stuart Bruff
Next thread: [mathcad] RE: How to fill a column of a matrix?, Oakley, Philip SELEX UK
|
|
|