Re: Beginner: List Indexing and Assignment
- To: mathgroup at smc.vnet.net
- Subject: [mg94497] Re: Beginner: List Indexing and Assignment
- From: C Rose <cjr.list.alias.1 at me.com>
- Date: Mon, 15 Dec 2008 07:42:52 -0500 (EST)
Thanks Jean-Marc.
Chris
>You can apply transformation rules directly to the matrices. For
>instance, a = a /. x_ /; x > 2 -> -1
>
>
>In[1]:= a = {{1, 2, 3}, {4, 5, 6}}
>
>Out[1]= {{1, 2, 3}, {4, 5, 6}}
>
>In[2]:= MatrixForm[a]
>
>Out[2]//MatrixForm=
>
>1 2 3
>
>4 5 6
>
>In[3]:= a = a /. x_ /; x > 2 -> -1
>
>Out[3]= {{1, 2, -1}, {-1, -1, -1}}