MathGroup Archive 2008

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

Search the Archive

Re: Re: Creating a set from two other sets

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84779] Re: [mg84774] Re: Creating a set from two other sets
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Mon, 14 Jan 2008 03:45:49 -0500 (EST)
  • Reply-to: hanlonr at cox.net

Clear[f];
f[x_ /; 3 <= x <= 10] := x^2;

Plot[f[x], {x, 0, 13},
 PlotStyle -> {{Red, Thick}},
 Frame -> True, Axes -> False]

Clear[f];
f[x_] := x^2 /; 3 <= x <= 10;

Plot[f[x], {x, 0, 13},
 PlotStyle -> {{Red, Thick}},
 Frame -> True, Axes -> False]

Clear[f];
f[x_] := Piecewise[{{x^2, 3 <= x <= 10}}];

Plot[f[x], {x, 0, 13},
 PlotStyle -> {{Red, Thick}},
 Frame -> True, Axes -> False]

In the first two cases, the function is undefined outside of the range 3<=x<=10. In the last case, it defaults to 0 outside of the specified range.


Bob Hanlon

---- Arne Hallam <ahallam at iastate.edu> 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



  • Prev by Date: Re: problem with MLGetReal64Array
  • Next by Date: Re: Re: Creating a set from two other sets
  • Previous by thread: Re: Creating a set from two other sets
  • Next by thread: Re: Re: Creating a set from two other sets