Two questions about modification of a matrix.
- To: mathgroup at smc.vnet.net
- Subject: [mg101041] Two questions about modification of a matrix.
- From: Mayasky <alix.zhang at gmail.com>
- Date: Mon, 22 Jun 2009 04:22:19 -0400 (EDT)
Suppose there is a N*N matrix. 1. How can I change all elements that satisfy i*j>N to 0 ? (Here i, j is position of this element, as in mat[[i,j]]) 2. How can I change all negative elements in that matrix to 0 ? I know a "for loop" can be used, I just wonder if there is any more concise and beautiful ways. (I doubt Mathematica doesn't have a 'find' function as in another system which conveniently returns indice of elements that satisfy a certain condition)
- Follow-Ups:
- Re: Re: Two questions about modification of a
- From: Leonid Shifrin <lshifr@gmail.com>
- Re: Two questions about modification of a matrix.
- From: Leonid Shifrin <lshifr@gmail.com>
- Re: Two questions about modification of a matrix.
- From: Chenguang Zhang <alix.zhang@gmail.com>
- Re: Two questions about modification of a matrix.
- From: "Scot Martin" <smartin@seas.harvard.edu>
- Re: Re: Two questions about modification of a