Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8456 > unrolled thread

Re: Simply but handy question

Started byPaul Whelan <jediwhelan@googlemail.com>
First post2012-02-10 11:01 +0000
Last post2012-02-10 11:01 +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.


Contents

  Re: Simply but handy question Paul Whelan <jediwhelan@googlemail.com> - 2012-02-10 11:01 +0000

#8456 — Re: Simply but handy question

FromPaul Whelan <jediwhelan@googlemail.com>
Date2012-02-10 11:01 +0000
SubjectRe: Simply but handy question
Message-ID<jh2te8$s2$1@smc.vnet.net>
Hi Alexei,

this is a nice solution ! thanks

On Thu, Feb 9, 2012 at 8:52 AM, Alexei Boulbitch <Alexei.Boulbitch@iee.lu>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****
>
> ** **
>
> Hi, Paul,****
>
> Try this: ****
>
> ** **
>
> matrix1 = {{a, b}, {0, c}};****
>
> matrix2 = {{a, b, 0}, {c, 0, 15}, {0, 2, d}};****
>
> ** **
>
> g[a_] := If[a =!= 0, 1, 0];****
>
> Map[g, matrix1, {2}] // MatrixForm****
>
> Map[g, matrix2, {2}] // MatrixForm****
>
> ** **
>
> Have fun, Alexei****
>
> *Alexei BOULBITCH**, Dr., habil.*****
>
> IEE S.A.****
>
> ZAE Weiergewan,****
>
> 11, rue Edmond Reuter,****
>
> L-5326 Contern, LUXEMBOURG****
>
> ** **
>
> Office phone :  +352-2454-2566****
>
> Office fax:       +352-2454-3566****
>
> mobile phone:  +49 151 52 40 66 44****
>
> ** **
>
> e-mail: alexei.boulbitch@iee.lu****
>
> ** **
>
> ** **
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web