7
$\begingroup$

I have an implicit region:

R = ImplicitRegion[-Sqrt[-1 + 1/4 (x + 1/(x + I y) + I y)^2] + 
   1/2 (x + 1/(x + I y) + I y) == x + I y, {x, y}]

I tried plotting it with RegionPlot:

RegionPlot[R, PlotRange -> {{-2.5, 2.5}, {-2.5, 2.5}}]

but got an error message,

RegionPlot::invplotreg: {ImplicitRegion[-Sqrt[-1+Times[<<2>>]]+1/2 (x+1/Plus[<<2>>]+I y)==x+I y,{x,y}]} is not a valid region to plot. >>

Manually executing RegionPlot seems to work:

RegionPlot[-Sqrt[-1 + 1/4 (x + 1/(x + I y) + I y)^2] + 
   1/2 (x + 1/(x + I y) + I y) == x + I y, {x, -2, 2}, {y, -2, 2}]

which produces

enter image description here

Similarly, I tried to discretize the region:

DiscretizeRegion[R, {{-2.5, 2.5}, {-2.5, 2.5}}]

but got an error message:

DiscretizeRegion::drf: DiscretizeRegion was unable to discretize the region ImplicitRegion[<<2>>]. >>

Any ideas as to where I am going wrong?

Edit

Algohi has suggested that the problem might have to do with the fact that the truth statement is an equality of complex quantities, which might confuse ImplicitRegion into thinking that it's dummy variables are meant to be taken over the complex numbers, which contradicts the Documentation's stipulation that the values are in $\mathbb R^n$. Unfortunately, this is not the case, as the following counterexample shows:

R = ImplicitRegion[y + I x == y - I x, {x, y}]
RegionPlot[R]

which correctly produces:

enter image description here

$\endgroup$
3
  • $\begingroup$ To the downvoter: what part of my question was unclear? I would appreciate feedback if my question needs to be reworked. $\endgroup$ Oct 11, 2014 at 17:21
  • $\begingroup$ I don't think your lase example is a valid one. y + I x == y - I x // Simplify results in x == 0. Try some example where (I) can't be factored out. $\endgroup$ Oct 12, 2014 at 19:24
  • $\begingroup$ @Algohi: Hmm, trying some other nontrivial examples gives errors. Still, it makes no sense. My expression is a well-defined map $f:\mathbb{R}^2\rightarrow\{0,1\}$. The fact that the internal arithmetic uses complex numbers does not alter the function signature, which is a map of the real plane to truth values, so I can't understand why ImplicitRegion cannot handle it. $\endgroup$ Oct 12, 2014 at 19:51

3 Answers 3

5
$\begingroup$

I believe the problem stands in ImplicitRegion. A workaround is to use Reduce as done below. Also, you should impose explicitly that x and y are Reals.

R = Reduce[-Sqrt[-1 + 1/4 (x + 1/(x + I y) + I y)^2] + 1/2 (x + 1/(x + I y) + I y) == x + I y && x \[Element] Reals && y \[Element] Reals, {x, y}]
RegionPlot[R, {x, -2.5, 2.5}, {y, -2.5, 2.5}]

enter image description here

$\endgroup$
2
$\begingroup$

I am not sure about this but it looks like ImplicitRegion works only with real domain.

enter image description here

$\endgroup$
3
  • $\begingroup$ Thanks for the answer. However, the plotting region I have used is real-valued (see the examples I provided). It is only the expression itself that is complex-valued (or rather, it is boolean-valued, but is an equality of complex expressions); the variables x and y are being plotted over a real region, so I'm not sure this answers my question. $\endgroup$ Oct 11, 2014 at 21:33
  • $\begingroup$ I don't understand when you say your region is real valued. I see an imaginary number (I) in you expression. $\endgroup$ Oct 12, 2014 at 2:11
  • $\begingroup$ No, the region is real-valued; the expression is Boolean-valued and is comprised of an Equal statement which contains an I in one of it's sub-branches. That does not make the region real-valued. As further proof, I appended a counterexample to my question, which shows that ImplicitRegion is capable of handling complex-valued expressions. $\endgroup$ Oct 12, 2014 at 13:50
1
$\begingroup$
ℛ = -Sqrt[-1 + 1/4 (x + 1/(x + I y) + I y)^2] + 
   1/2 (x + 1/(x + I y) + I y) == x + I y

enter image description here

RegionPlot[ℛ, {x, -2.5, 2.5}, {y, -2.5, 2.5}]

enter image description here

$\endgroup$
4
  • 3
    $\begingroup$ Hmm, I'm confused. OP already showed this can be done. $\endgroup$
    – RunnyKine
    Oct 11, 2014 at 16:30
  • $\begingroup$ Yeah, I already showed that a direct application of RegionPlot on the expression works properly in my question, but that's not what my question was asking. My question was twofold: why does RegionPlot fail on the equivalent ImplicitRegion, and why does DiscretizeRegion also fail on the ImplicitRegion? $\endgroup$ Oct 11, 2014 at 16:44
  • $\begingroup$ @RunnyKine: Any idea what my problem could be? My question seems to be getting downvoted, and I'm not sure if I've just done something silly. $\endgroup$ Oct 11, 2014 at 17:23
  • 1
    $\begingroup$ @DumpsterDoofus. Your question is perfectly valid. The only thing I can say is ImplicitRegion is not ready for primetime. I've experienced a lot of problems with it. $\endgroup$
    – RunnyKine
    Oct 11, 2014 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.