Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: Function definition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg18216] Re: Function definition
  • From: Guilherme Roschke <gr at network3.entropy.upenn.edu>
  • Date: Tue, 22 Jun 1999 20:41:11 -0400
  • Organization: University of Pennsylvania
  • References: <7kmtmi$230@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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