MathGroup Archive 2004

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

Search the Archive

Re: Boolean Type

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52433] Re: [mg52415] Boolean Type
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sat, 27 Nov 2004 01:40:27 -0500 (EST)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

func[x_ /; Element[x, Reals]] := x^2;
func[x_ /; Element[x, Booleans]] := Not[x];

or

func[x_?(Element[#, Reals]&)] := x^2;
func[x_?(Element[#, Booleans]&)] := Not[x];


Bob Hanlon

> 
> From: jmyers6761 at aol.com (JMyers6761)
To: mathgroup at smc.vnet.net
> Date: 2004/11/26 Fri AM 01:04:57 EST
> To: mathgroup at smc.vnet.net
> Subject: [mg52433] [mg52415] Boolean Type
> 
> All,
> 	I would like to define a function wich would work (in different ways) for 
both
> real and boolean input argruments. How should I best implement a 
function which
> would implement the following intent?
> 
> func[x_Real]:= some function involving a real varialble x
> 
> func[x_Boolean]:= some function involving a boolean variable x
> 
> Thanks for any help.
> 
> Al Myers
> 
> 
> 


  • Prev by Date: Re: Boolean Type
  • Next by Date: Re: Separating constants from nonconstants in an expression
  • Previous by thread: Re: Boolean Type
  • Next by thread: zero eigenvalues and corresponding eigenvectors of a square and a rectangular matrice