MathGroup Archive 2003

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

Search the Archive

Re: RealOnly


"Ray" <rayfg at optonline.net> wrote in message
news:b1idka$bk3$1 at smc.vnet.net...
> If I activate <<Miscellaneous`RealOnly` to do a calculation where I only
> want real values, how can I get rid of it so I can do a different
> calculation involving complex values. In other words, how do I close the
> RealOnly function. Is there another way of doing a calculation that will
> work only in the reals without opening RealOnly. Thanks.
>

Ray,
Here is a modification of a posting by Bob Hanlon in Sept 2000.


    RealOnly /: On[RealOnly] :=
        Needs[ "Miscellaneous`RealOnly`"];

    RealOnly /: Off[RealOnly] :=
       (Unprotect[Power, Solve, Roots]; Clear[Power, Solve,
         Roots]; Protect[Power, Solve, Roots];
        Remove["Miscellaneous`RealOnly`Nonreal"]; $Post =. )

Check

    (-1.)^(1/3)

        0.5 + 0.8660254037844387*I

    On[RealOnly]
    (-1.)^(1/3)

        -1.

    Off[RealOnly]
    (-1.)^(1/3)

        0.5 + 0.8660254037844387*I


--
Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565





  • Prev by Date: Re: Processing lists of unrelated numbers with Do or While statement
  • Next by Date: Re: Processing lists of unrelated numbers with Do or While statement
  • Previous by thread: RE: RealOnly
  • Next by thread: Re: RealOnly