MathGroup Archive 2001

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

Search the Archive

Re: Classifying by Inequalities???

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29220] Re: [mg29212] Classifying by Inequalities???
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Tue, 5 Jun 2001 04:21:51 -0400 (EDT)
  • References: <200106040930.FAA15721@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Here is a possibility. However, your inequality rules do not cover all
logical cases, so you''ll get Null's in some instances:

In[1]:=
l1 = Table[{Random[Integer, {-9, 9}], Random[Integer, {-9, 9}]}, {10}]
Out[1]=
{{1, -2}, {6, -5}, {9, -1}, {6, -4}, {-1, 3}, {7, 2}, {-1, 3}, {5,
    4}, {-1, -8}, {-3, -2}}

In[2]:=
label[{a_, b_}] := Which[a < 0 && b < 0, "k",
         a < 0 && b == 0, "l",
         a < 0 && b < 0 && a == b, "m",
         a < 0 && b > 0, "n",
         a > 0 && b > 0, "p",
         a == 0 && b > 0, "q",
         a > 0 && b > 0 && a == b, "r"]

In[3]:=
label /@ l1
Out[3]=
{Null, Null, Null, Null, "n", "p", "n", "p", "k", "k"}

Tomas Garza
Mexico City
----- Original Message -----
From: <Moranresearch at aol.com>
To: mathgroup at smc.vnet.net
Subject: [mg29220] [mg29212] Classifying by Inequalities???


>
> I have a series of integers l1={{a1,b1},{a2,b2},...{ai,bi}}
> I want to label each pair in the series according to the inequality rules
> defined below
> such that I get a series of labels l2={n,k,p....}
>
> k   =  A<0  B<0
> l   =  A<0  B=0
> m   =  A<0  B<0 A=B
> n   =  A<0  B>0
> p   =  A>0  B>0
> q   =  A=0  B>0
> r   =  A>0  B>0 A=B
> Thanks. John
>
>



  • Prev by Date: Re: Notebook to PDF Windows
  • Next by Date: Re: Notebook to PDF Windows
  • Previous by thread: Classifying by Inequalities???
  • Next by thread: Re: Classifying by Inequalities???