MathGroup Archive 1999

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

Search the Archive

Re: Function definition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg18218] Re: Function definition
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Tue, 22 Jun 1999 20:41:12 -0400
  • Organization: Universitaet Leipzig
  • References: <7kmtmi$230@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

this depends on your understanding of "Real". If you mean it like a C
type
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
  Jens

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


  • 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