MathGroup Archive 1999

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

Search the Archive

Re: Function definition


Jesus Perez Ortega wrote:
> 
> Hi All,
> How can I restrict a variable to be Real in the function definition?
> Regards
> --
> Jesus Perez Ortega
> jesper at bqto.unexpo.edu.ve


say your function is foo[x_]:=x/2;

define instead foo[x_Real]:=x/2;

this way the pattern x will only match a real number.


*************************************************
Guilherme Roschke			 	*
Programmer					*
Dept. of Anesthesia				*
University of Pennsylvania Medical School	*
gr at network3.entropy.upenn.edu			*
*************************************************


  • Prev by Date: Re: Some problems with complex functions like Sqrt[z]
  • Next by Date: Re: Scoping and named patterns
  • Previous by thread: Re: Function definition
  • Next by thread: Re: Function definition