MathGroup Archive 1999

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

Search the Archive

Re: Function definition

  • To: mathgroup at
  • Subject: [mg18216] Re: Function definition
  • From: Guilherme Roschke <gr at>
  • Date: Tue, 22 Jun 1999 20:41:11 -0400
  • Organization: University of Pennsylvania
  • References: <7kmtmi$>
  • Sender: owner-wri-mathgroup at

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

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			*

  • 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