|
[Date Index]
[Thread Index]
[Author Index]
Re: simple questions about matrices
- To: mathgroup at smc.vnet.net
- Subject: [mg26479] Re: [mg26472] simple questions about matrices
- From: Ken Levasseur <Kenneth_Levasseur at uml.edu>
- Date: Thu, 28 Dec 2000 02:52:19 -0500 (EST)
- References: <200012230346.WAA13016@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Cristian:
Here is how you perform the matrix operations.
Merry Christmas!
Ken Levasseur
Mathematical Sciences
UMass Lowell
Three credit on-line Introduction to Mathematica starts at the end of
January: http://faculty.uml.edu/klevasseur/courses/m419/m419.html
> (a) I have a (m,n) matrix a with integer entries.How can I construct
> a separate list with the totals of adding the entries of either the
> rows or columns?
>
In[3]:=
m = Table[Random[Integer, {0, 10}], {4}, {5}]
Out[3]=
{{9, 1, 10, 4, 3}, {4, 7, 6, 9, 7}, {4, 5, 3, 3, 1}, {10, 8, 6, 4, 0}}
In[4]:=
rowsums = Apply[Plus, m, 1]
Out[4]=
{27, 33, 16, 28}
In[5]:=
columnsums = Apply[Plus, Transpose[m], 1]
Out[5]=
{27, 21, 25, 20, 11}
> (b) How can I construct a (m+1,n) matrix where the new row's entries
> are the sums of all numbers on each column?
>
In[6]:=
Append[m, columnsums]
Out[6]=
{{9, 1, 10, 4, 3}, {4, 7, 6, 9, 7}, {4, 5, 3, 3, 1}, {10, 8, 6, 4, 0},
{27, 21, 25, 20, 11}}
> (c) In general,how can I attach additional columns (o rows) to an
> existing matrix?
>
Most of the more complicated operations can be done most easily by using
the MatrixManipulation package:
In[7]:=
Needs["LinearAlgebra`MatrixManipulation`"]
In[8]:=
Information["LinearAlgebra`MatrixManipulation`*",
LongForm -> False]
AppendColumns MatrixNorm
AppendRows PolarDecomposition
BlockMatrix SquareMatrixQ
CheckLinearity SubMatrix
HankelMatrix TakeColumns
HilbertMatrix TakeMatrix
InverseMatrixNorm TakeRows
LinearEquationsToMatrices TridiagonalMatrix
LowerDiagonalMatrix UpperDiagonalMatrix
LUMatrices VectorNorm
MatrixConditionNumber ZeroMatrix
Cristian Opazo-Castillo wrote:
> Hello all:
>
> I hope that someone is still working and could help me with this...
>
> (a) I have a (m,n) matrix a with integer entries. How can I construct
> a separate list with the totals of adding the entries of either the
> rows or columns?
>
> (b) How can I construct a (m+1,n) matrix where the new row's entries
> are the sums of all numbers on each column?
>
> (c) In general, how can I attach additional columns (o rows) to an
> existing matrix?
>
> Thanks a lot and Happy Holidays,
>
> Cristian
Prev by Date:
Re: plot time vs date
Next by Date:
Re: Question: nonlinear differential equation with boundary conditions
Previous by thread:
simple questions about matrices
Next by thread:
Re: simple questions about matrices
|