MathGroup Archive 2006

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

Search the Archive

Re: Set function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64430] Re: Set function
  • From: dh <dh at metrohm.ch>
  • Date: Fri, 17 Feb 2006 04:11:37 -0500 (EST)
  • References: <dt1c5b$1r$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Unal,
(a,b] is not a data structure available in Mathematica.
You must use data structures of the Form Type[data], where Type can e.g. 
be List or a Type of your own choosing.

Examples using Lists:

ClosedSet={closed,a,b,closed}; OpenSet={open,a,b,open};
SemiCLosed={open,a,b,closed}

Example using ArbitraryType[data..]:

MyOpenSet= MySet[open,a,b,open]
or we can put the information about closeness into the header:
MyOpenSet= OpenSet[a,b]

Functions can then be set up like:

fun[{open,a_,b_,open}]:=....  for the first case or

fun[MySet[open,a_,b_,open]]:=..

or

fun[OpenSet[a_,b_]]:=...

Here is an example:

MySet1 = OpenSet[2, 3];
MySet2 = CloseSet[1, 10];
fun[OpenSet[a_, b_]] := 2a - b;
fun[CloseSet[a_, b_]] := a - 5 b;

fun[MySet1]
fun[MySet2]

1
-49

Daniel

Unal Ufuktepe wrote:
> I am trying to do define set function as follows:
> Let A=[a,b]
> (closed set);or (a,b) (open set) or (a,b] or [a,b) (semi
> closed sets)
> f(A) is piecevise function with respect to A (closed, open
> or semi closed)
> 
> Let f(A)=2a-b if
> A=[a,b]
> =a-2b
> if A=(a,b)
> =3a-2b
> if A=(a,b]
> =5a-3b if
> A=[a,b)
> 
> How can I define this function? I tried "Switch"
> command but because of [. ],[. ),... symboles It did not
> worked.
> 
> 
> Unal Ufuktepe,PhD 
> Izmir Institute of Technology
> Department of Mathematics, 
> GUlbahce-Urla, Izmir 35435
> Phone:(232)-7507614 
> Home:232-7571614 
> Mobile phone: 5358969646
> 


  • Prev by Date: Re: Formatted Output (Exporting Data)
  • Next by Date: Re: Using a text editor like interface for Mathematica?
  • Previous by thread: Set function
  • Next by thread: Question on Thread