MathGroup Archive 1999

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

Search the Archive

Re: Re: Function definition


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?