       Re: Use of Miscellaneous`RealOnly` Package

• To: mathgroup at smc.vnet.net
• Subject: [mg25288] Re: Use of Miscellaneous`RealOnly` Package
• From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
• Date: Tue, 19 Sep 2000 03:45:12 -0400 (EDT)
• Organization: Universitaet Leipzig
• References: <8q21ps\$hpf@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Hi David,

this is one of the grimiest tricks I have ever made.
Look into the NonReal package. The rule added to Solve
Roots is

Miscellaneous`RealOnly`Private`x_ == _?!(FreeQ[Chop[N[#1]], _Complex])
&) :>
Miscellaneous`RealOnly`Private`x == Nonreal;

and you can switch it off by

Needs["Miscellaneous`RealOnly`"]

Block[{
Miscellaneous`RealOnly`Private`NonrealRule = a_ :> a,
Miscellaneous`RealOnly`Nonreal =
Miscellaneous`RealOnly`Nonreal`Private`x},
F[u_, v_] := {u^3, v - u};
eqns = Thread[F[u, v] == {x, y}];
{u^3 == x, -u + v == y};
sols = Solve[eqns, {u, v}][]
]

that simply turn the replacement into an identity tansformation.

Hope that helps
Jens

David Park wrote:
>
> Dear MathGroup,
>
> Is it possible to turn the Miscellaneous`RealOnly` package on and off?
> Consider the following problem. I want to find the inverse of the following
> function:
>
> F[u_, v_] := {u^3, v - u}
>
> eqns = Thread[F[u, v] == {x, y}]
> {u^3 == x, -u + v == y}
>
> sols = Solve[eqns, {u, v}][]
> {v -> x^(1/3) + y, u -> x^(1/3)}
>
> If the above Solve is done with the RealOnly package active, it fails and
> gives Nonreal for the answers. So I definitely don't want it active at this
> point. Now I define the inverse:
>
> FI[x_, y_] = ({u, v} /. sols)
> {x^(1/3), x^(1/3) + y}
>
> Now when I evaluate
>
> FI[-10, -10] // N
> {1.077217345015942 + 1.865795172362064*I, -8.922782654984058 +
>    1.865795172362064*I}
>
> I obtain the complex root, so I need to load RealOnly package.
>
> << Miscellaneous`RealOnly`
> FI[-10, -10] // N
> {-2.15443, -12.1544}
>
> So sometimes I want it, and sometimes I don't want it. But there seems no
> way to get rid of it other than quitting the kernel.
>
> Does anyone have any suggestions, or a smoother way to do this problem?
>
> David Park