Re: RealOnly

• To: mathgroup at smc.vnet.net
• Subject: [mg39196] Re: RealOnly
• From: "Allan Hayes" <hay at haystack.demon.co.uk>
• Date: Mon, 3 Feb 2003 01:09:47 -0500 (EST)
• References: <b1idka\$bk3\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```"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