Comparing Corresponding Columns of Two Matrices
- To: mathgroup at smc.vnet.net
- Subject: [mg97496] Comparing Corresponding Columns of Two Matrices
- From: Gregory Lypny <gregory.lypny at videotron.ca>
- Date: Sat, 14 Mar 2009 05:39:39 -0500 (EST)
Hello everyone, I'm trying to develop a modest skill in mapping functions and I've been working on this problem. Suppose I have two 100 x 4 matrices, X and Y, and I want to see whether each value in a column of X is bigger than each value in the corresponding column of Y. In other words, compare column 1 of X with column 1 of Y, column 2 of X with column 2 of Y, and so on. It's easy to generate a 100 x 4 table of Booleans using Table as Table[Boole[X[[i , j]] > Y[[i, j]]], {i, 100}, {j, 4}] But what about without Table? I am able to do it for the comparison of any one column as Boole[#[[1]] > #[[2]]] & /@ Transpose[{X[[All, ]], Y[[All, 1]]}] but I'm not sure how to extend this to other columns. Any tip would be much appreciated. Regards, Gregory
- Follow-Ups:
- Re: Comparing Corresponding Columns of Two Matrices
- From: DrMajorBob <btreat1@austin.rr.com>
- Re: Comparing Corresponding Columns of Two Matrices
- From: Gregory Lypny <gregory.lypny@videotron.ca>
- Re: Comparing Corresponding Columns of Two Matrices
- From: DrMajorBob <btreat1@austin.rr.com>
- Re: Comparing Corresponding Columns of Two Matrices