MathGroup Archive 1999

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

Search the Archive

Re: Re: Function definition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg18230] Re: [mg18215] Re: Function definition
  • From: "Kevin J. McCann" <kevinmccann at Home.com>
  • Date: Thu, 24 Jun 1999 14:24:15 -0400
  • References: <7kmtmi$230@smc.vnet.net> <199906230041.UAA04366@smc.vnet.net.>
  • Sender: owner-wri-mathgroup at wolfram.com

Here is a further suggestion

 Remove[foo]
foo[x_ /; x \[Element] Reals] := x
foo[x_ /; Im[x] == 0] := x

then
foo[1.234]
1.234

foo[Pi]
Pi

foo[I]
foo[I]

But now you can also do the following:

<< "Algebra`ReIm`"
Re[y] ^= y; 
Im[y] ^= 0; 
Abs[y] ^= y; 

foo[y]
y

so you can define variables to be real.

Kevin



  • Prev by Date: Re: Canceling square roots with Simplify
  • Next by Date: Re: Moving average type process
  • Previous by thread: Re: Function definition
  • Next by thread: Mathematica for Activex?