MathGroup Archive 1999

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

Search the Archive

Re: Function definition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg18215] Re: Function definition
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Tue, 22 Jun 1999 20:41:11 -0400
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <7kmtmi$230@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In Mathematica 4, for example:

   f[x_ /; x \[Element] Reals] := x^2

   f[1.2]
1.44

   f[2]

4

   f[2 + 3 I]
f[2 + 3 I]


Of course, one would probably enter the condition on x in the form Esc
elem Esc to produce an actual epsilon-like "element-of" symbol in
StandardInput form.

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

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.       phone 413 549-1020 (H)
Univ. of Massachusetts                     413 545-2859 (W)
Amherst, MA 01003-4515


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