MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How can I perform Matrix comparison?Can any one with kindness help

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114816] Re: How can I perform Matrix comparison?Can any one with kindness help
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Fri, 17 Dec 2010 23:48:52 -0500 (EST)

On 12/17/10 at 3:29 AM, fmingu at 163.com (fmingu) wrote:

>I am using mathematica for practical purpose. I wonder how can I
>perform Matrix comparison.

>For instance:
>a={{2,3},{4,5}};
>b={{1,2},{2,3}};

>a>b I want the result is True. But it seems that Mathematica can not
>recognize it. I do not know how I can solve it? Are there any
>additional package to be added? Can any one with kindness help me?

The result of a>b isn't defined in Mathematics when a and b are
matrices. So, it should be no surprise there isn't a built in
function or package to do this comparison. But there are a
number of ways to achieve the desired result. For example:

In[7]:= And @@ Flatten@Map[Less, Transpose[{a, b}, {1, 3, 2}], {2}]

Out[7]= True

or

In[8]:= And @@ (Greater @@@ Transpose[Flatten /@ {a, b}])

Out[8]= True



  • Prev by Date: Re: TextRecognize tabular data
  • Next by Date: Re: How can I perform Matrix comparison?Can any one with kindness help
  • Previous by thread: How can I perform Matrix comparison?Can any one with kindness help
  • Next by thread: Re: How can I perform Matrix comparison?Can any one with kindness help