Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Dynamic iterators in Do loop

  • To: mathgroup at
  • Subject: [mg66418] Re: Dynamic iterators in Do loop
  • From: Paul Abbott <paul at>
  • Date: Thu, 11 May 2006 05:36:16 -0400 (EDT)
  • Organization: The University of Western Australia
  • References: <e3js6u$8jt$>
  • Sender: owner-wri-mathgroup at

In article <e3js6u$8jt$1 at>, sai <iwillfail at> 

> I have an (n,n) matrix. I want to define an (m,m) matrix [m<n] whose elements 
> are defined from the (n,n) matrix. The value of n and m changes from problem 
> to problem. How can i do this in mathematica?

For an arbitrary matrix, say

  mat[n_] := Table[a[i, j], {i,n},{j,n}]

then the easiest way to extract a block of the matrix is to use Part 
with Range. For example,

  mat[10][[ Range[2,5],Range[3,6] ]]

extracts a 4 x 4 submatrix from the 10 x 10 matrix.


Paul Abbott                                      Phone:  61 8 6488 2734
School of Physics, M013                            Fax: +61 8 6488 1014
The University of Western Australia         (CRICOS Provider No 00126G)    

  • Prev by Date: Re: two graphics questions and one general question
  • Next by Date: Re: Recursion inspection technique : HoldForm but release variables
  • Previous by thread: Re: Dynamic iterators in Do loop
  • Next by thread: Intersection of Conic Sections