Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: Use of Miscellaneous`RealOnly` Package

  • To: mathgroup at
  • Subject: [mg25274] Re: [mg25253] Use of Miscellaneous`RealOnly` Package
  • From: BobHanlon at
  • Date: Sun, 17 Sep 2000 17:33:40 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

In a message dated 9/17/2000 5:04:26 AM, djmp at writes:

>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
>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}][[1]]
>{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?

F[u_, v_] := {u^3, v - u};

FI[x_, y_] := Evaluate[Module[{u, v},
      ({u, v} /. Solve[Thread[F[u, v] == {x, y}], {u, v}][[1]])]]

To turn RealOnly on:

On[RealOnly] := Get["Miscellaneous`RealOnly`"];

Power, Solve, Roots, and $Post".  Consequently, to remove the effects of 

Off[RealOnly] := Module[{}, 
    Unprotect[Power, Solve, Roots]; 
    Clear[Power, Solve, Roots]; 
    Protect[Power, Solve, Roots];
    Remove["Miscellaneous`RealOnly`Nonreal"]; $Post =.;]



FI[-10, -10] // N

{-2.1544346900318834, -12.154434690031884}


FI[-10, -10] // N

{1.0772173450159421 + 1.8657951723620638*I, 
  -8.922782654984058 + 1.8657951723620638*I}


(FI[-10, -10] // N)  == %%%%



Bob Hanlon

  • Prev by Date: Re: ParametricPlot3D is buggy
  • Next by Date: Re: Question
  • Previous by thread: Use of Miscellaneous`RealOnly` Package
  • Next by thread: Re: Use of Miscellaneous`RealOnly` Package