MathGroup Archive 1999

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

Search the Archive

Re: Function definition

  • To: mathgroup at
  • Subject: [mg18218] Re: Function definition
  • From: Jens-Peer Kuska <kuska at>
  • Date: Tue, 22 Jun 1999 20:41:12 -0400
  • Organization: Universitaet Leipzig
  • References: <7kmtmi$>
  • Sender: owner-wri-mathgroup at


this depends on your understanding of "Real". If you mean it like a C
that is not possible you can restrict the head like

f[x_Real]:= ...

but it may be better use

f[x_?NumericQ]:= ..

so that f[1/2] and f[Pi] is also working.

Hope that helps

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

  • Prev by Date: Re: problem with Part function
  • Next by Date: Re: Some problems with complex functions like Sqrt[z]
  • Previous by thread: Function definition
  • Next by thread: Re: Function definition