Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8416 > unrolled thread
| Started by | Christoph Lhotka <christoph.lhotka@fundp.ac.be> |
|---|---|
| First post | 2012-02-09 10:40 +0000 |
| Last post | 2012-02-09 10:40 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Simply but handy question Christoph Lhotka <christoph.lhotka@fundp.ac.be> - 2012-02-09 10:40 +0000
| From | Christoph Lhotka <christoph.lhotka@fundp.ac.be> |
|---|---|
| Date | 2012-02-09 10:40 +0000 |
| Subject | Re: Simply but handy question |
| Message-ID | <jh07rn$hv2$1@smc.vnet.net> |
hi, if you really need the matrix use a pattern rule like:
Y/. x_Integer :> 1 /; NumericQ[x]&&x != 0
which will replace all non-zero values with one.
if you just need to know the position of the zeros use
Position[Y, 0, \[Infinity]]
which will return a list of positions in Y which are zero.
best,
christoph
On 02/08/2012 11:29 AM, jediwhelan wrote:
> Dear group members,
>
> I am new to mathematica (well, I'm not actually but I haven't used it
> in 5 years +).
>
> Is there an easy way to return a matrix X of 1's and 0's to test
> whether the entries in Y
> are different from zero.
>
> i.e.,
>
> if Y = {{a,b},{0,c}}
>
> Then X would return
>
> X = {{1,1},{0,1}}
>
> This would be handy for very large or complicated matrices where one
> would like to know if specific entries are zero?
>
> Many thanks,
> Paul
>
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web