MathGroup Archive 2004

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

Search the Archive

Re: Boolean Type

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


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

Bob Hanlon

> From: jmyers6761 at (JMyers6761)
To: mathgroup at
> Date: 2004/11/26 Fri AM 01:04:57 EST
> To: mathgroup at
> Subject: [mg52433] [mg52415] Boolean Type
> All,
> 	I would like to define a function wich would work (in different ways) for 
> 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