MathGroup Archive 2008

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

Search the Archive

Re: Re: Re: Re: Creating a set from two other sets

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84827] Re: [mg84814] Re: [mg84788] Re: [mg84774] Re: Creating a set from two other sets
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Wed, 16 Jan 2008 03:23:12 -0500 (EST)

On 14 Jan 2008, at 23:23, Arne Hallam wrote:

This is excellent.

It there any way to create this set to that only the integer members or
the rational members are included? I was not sure how to use a
conditional assignment here.

There is no built-in way since Interval is not really intended for any
set-theoretic purpose (its intended purpose is to implment "interval
arithmetic" used primarily for numerical error analysis etc.). But it
is easy to create a predicate function that will, in a sense, define
such a set, e.g.

RationalIntervalMemberQ[x_Interval, a_] :=
Element[a, Rationals] && IntervalMemberQ[x, a]

Now
RationalIntervalMemberQ[Interval[{-1, 1/3}, {2, 10}], Pi]
False

RationalIntervalMemberQ[Interval[{-1, 1/3}, {2, 10}], Rationalize[Pi,
0.1]]
True

Note however, that in Mathematica approximate reals are not considered
rationals so

RationalIntervalMemberQ[Interval[{0, 2}], 1.]
False

while, of course,

In[28]:= RationalIntervalMemberQ[Interval[{0, 2}], 1]
  Out[28]= True

Andrzej Kozlowski






Andrzej Kozlowski wrote:
It depends, of course, on what you want to do with it, but for some
purposes the simplest way is to use Interval, e.g.:


IntervalMemberQ[int1, 4]
True
IntervalMemberQ[int2, 4]
False
IntervalIntersection[int1, int2]
Interval[{5, 10}]
and so on.
Andrzej Kozlowski
On 14 Jan 2008, at 17:50, Arne Hallam wrote:
This is great. Thank you.
I did not know how to use table in picking from a set. I had defined
the sets a and b so I just did the following.
a={0, 1, 2, 3, 4};
b={-1, 1, 2, 3};
SA=Table[x/y,{x,a},{y,b}]
Thanks.
Any easy way to create a set with an infinite number of members as in
3<=x<=10?
Bob Hanlon wrote:
In v6 you can also do this directly with Table
Outer[#1/#2 &, {0, 1, 2, 3, 4}, {-1, 1, 2, 3}] ==
Table[a/b, {a, {0, 1, 2, 3, 4}}, {b, {-1, 1, 2, 3}}]
True
Bob Hanlon
---- Steve Luttrell <steve at _removemefirst_luttrell.org.uk> wrote:
In[1]:= Outer[#1/#2&,{0,1,2,3,4},{-1,1,2,3}]
Out[1]=
{{0,0,0,0},{-1,1,1/2,1/3},{-2,2,1,2/3},{-3,3,3/2,1},{-4,4,2,4/3}}
Stephen Luttrell
West Malvern, UK
<ahallam at iastate.edu> wrote in message news:fmcqap$ga0$1 at smc.vnet.net...
So I would like to create a set AB which consists of all ratios a/b
where a is an element of {0,1,2,3,4} and b is an element of
{-1,1,2,3}. Table does not seem to let me use elements of a set as
compared to sequential lists.
Any ideas?
--
with all thy getting get understanding---Proverbs 4:7.
The gentle art of being gentle---of kindness and forgiveness,
sensitivity and thoughtfulness and generosity and humility and good
old-fashioned love---have gone out of fashion. Ironically, everyone is
demanding their rights, and this demand is so shrill that it destroys
one of the most basic rights, if we can put it like that: the right, or
at least the longing and hope, to have a peaceful, stable, secure, and
caring place to live, to be, to learn, and to flourish---N.T. Wright.
In the wildness of speculation it has been suggested (of course more in
jest than in earnest),that Europe ought to grow its corn in America, and
devote itself solely to manufactures and commerce, as the best sort of
division of the labour of the globe---Thomas Malthus, An Essay on the
Principle of Population Book III, Chapter XII.
Arne Hallam
Department of Economics
266 Heady Hall
Iowa State University
Ames, IA 50011
ahallam at iastate.edu
Work: 515-294-5861
FAX: 515-294-0221
Home: 515-292-8739

--
with all thy getting get understanding---Proverbs 4:7.

The gentle art of being gentle---of kindness and forgiveness,
sensitivity and thoughtfulness and generosity and humility and good
old-fashioned love---have gone out of fashion. Ironically, everyone is
demanding their rights, and this demand is so shrill that it destroys
one of the most basic rights, if we can put it like that: the right, or
at least the longing and hope, to have a peaceful, stable, secure, and
caring place to live, to be, to learn, and to flourish---N.T. Wright.

In the wildness of speculation it has been suggested (of course more in
jest than in earnest),that Europe ought to grow its corn in America,
and devote itself solely to manufactures and commerce, as the best sort
of division of the labour of the globe---Thomas Malthus, An Essay on
the Principle of Population Book III, Chapter XII.

Arne Hallam
Department of Economics
266 Heady Hall
Iowa State University
Ames, IA 50011

ahallam at iastate.edu
Work:	515-294-5861
FAX: 	515-294-0221
Home:	515-292-8739


  • Prev by Date: Can you minimize a notebook window from a notebook in Version 6? and
  • Next by Date: Re: Fill between points in ListPointPlot3D not working?
  • Previous by thread: Re: Re: Re: Creating a set from two other sets
  • Next by thread: Find / Replace in List problem ... v6.01