Group Abstract Group Abstract

Message Boards Message Boards

1
|
4.2K Views
|
8 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Plotting a set using its definition?

Is there a Mathematica function that plots a set directly from something relating to a set description like {x, y}/Sqrt[x^2 + y^2]. I know many ways to draw that set (the unit circle) by reinterpreting it myself. I've tried several different approaches without sucess.

POSTED BY: Jay Gourley
8 Replies

You mean you have a set that is described as the image of a function? That sounds like a job for ParametricPlot:

ParametricPlot[{x, y}/Sqrt[x^2 + y^2], {x, y} \[Element] Annulus[]]
POSTED BY: Gianluca Gorni

You may also consider FunctionRange.

POSTED BY: Gianluca Gorni

To specify a general domain the syntax is

ParametricPlot[function, Element[{x,y}, domain] ]
POSTED BY: Gianluca Gorni

Thanks, Gianluca Gorni. Your explanation was helpful that the ReplaceAll[] in my ParametricPlot[] call was not causing ParametricPlot[] to use the correct domain. I assume from your answer that it is a limitation in Mathematica and not my misuse of ReplaceAll[].

What I am still uncertain about is whether there is some way to define a domain for ParametricPlot[] (and other plotting functions) that does not require foreknowledge of the expected image. If not, is there another plotting function that will accept a well-defined domain to a function.

Mathematica is great for function-defining. So a solution that includes preprocessing by other functions like Reduce[], Solve[], FunctionDomain[], etc. would answer my question.

Another related question is whether there is a way to know (or even guess) what singularities will be problematic for a plotting function. Plotting functions handle some singularities without even showing them.

POSTED BY: Jay Gourley

When you give the x,y range as {x, -2, 2}, {y, -2, 2} you are implicitly taking a rectangle as domain, and you are including the origin, where the function is discontinuous. The discontinuity messes up the numerical algorithm that is used by ParametricPlot.

Try with {x, 1, 2}, {y, -2, 2}, which is a rectangle that does not contain the origin:

ParametricPlot[{x, y}/Sqrt[x^2 + y^2], {x, 1, 2}, {y, -2, 2}, 
 PlotRange -> {{-2, 2}, {-2, 2}}, Frame -> False, Axes -> True]
POSTED BY: Gianluca Gorni

Thanks again. Can you expand on that or point me to something that would explain it?

I understand why Annulus[] works in this example, but it doesn't generalize well since it requires more interpretation of the function than just identifying the singularity.

More importantly, I'm worried about some wrong assumptions I think I've been making all along. I didn't realize I was ignoring the domain. The example I posted uses ReplaceAll, but I get the same result using Assuming[], and Condition. Until now, I thought I was restricting my domain with those.

Also I don't understand the plotting problem with singularities. The plotting functions often handle singularities. In fact, they sometimes handle them too well since they can hide undefined points in rational expressions.

POSTED BY: Jay Gourley

The problem is that your function is singular at the origin. If you include the origin in the domain you will get nonsensical results from the numerical methods. That is why I chose Annulus[]. You cannot simply ignore the domain.

POSTED BY: Gianluca Gorni

Yes, I meant the image of a function. And thanks, Gianluca Gorni. It looks like ParametricPlot[] might be the answer. This forum is great.

Your solution works for my example. However, my hope is for a more general solution that doesn't rely on foreknowledge of the image. In other words, I'm looking for a FunctionImage[function_] that takes a function and returns its image, similar to the way ImplicitRegion[] and Region[] work with equations. I tried,...

ParametricPlot[{x, y}/Sqrt[x^2 + y^2], {x, -2, 2}, {y, -2, 2},
  PlotRange -> {{-2, 2}, {-2, 2}}, Frame -> False, Axes -> True] /.
 Abs[x] -> PositiveReals || Abs[y] -> PositiveReals

The image I got was a bounded region as opposed to the closed curve. In other words, the image looks correct on the part of the domain 1<=Sqrt[x^2+y^2] but not on 0<Sqrt[x^2+y^2]<1

Do you know of a refinement that would work?

Another approach that almost worked was,...

Region[
  ImplicitRegion[{x, y}/Sqrt[x^2 + y^2] == {x, y}, {x, y}],
  Axes -> True, PlotRange -> {{-2, 2}, {-2, 2}}] /.
 Abs[x] -> PositiveReals || Abs[y] -> PositiveReals

The output here shows only two points of the image.

POSTED BY: Jay Gourley
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard