MathGroup Archive 2012

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

Search the Archive

Re: ParametricPlot3D vs Reduce

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124092] Re: ParametricPlot3D vs Reduce
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Sun, 8 Jan 2012 04:28:40 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <je96dj$j22$1@smc.vnet.net>

On 2012.01.07. 11:22, Andrzej Kozlowski wrote:
> I just came across something somewhat baffling, though it could be the
> result of an imperfect understanding of how 3D graphic functions work.
> Consider the following three rational functions of two variables, which
> we will think of as parameters of a point on a surface in 3D.
>
> rats = {(-b - 2*d - b^3*d^2)/(b*d), (2*b + d + b^4*d +
>        2*b^3*d^2)/(b^2*d), (-1 - 2*b^3*d - b^2*d^2)/(b^2*d)};
>
> Now, note that:
>
> Reduce[Thread[-1<= rats<= 1], {b, d}]
>
> False
>
> in other words, there are no values of the parameters b and d for which
> the point lies in the unit cube. However:
>
> ParametricPlot3D[rats, {b, -10, 10}, {d, -10, 10},
>   PlotRange ->  {{-1, 1}, {-1, 1}, {-1, 1}},
>   AxesLabel ->  {"a", "b", "c"}]
>
> There appear to be several polygons inside the unit cube that should not
> be there?
>

Dear Andrzej,

It appears that rats is discontinuous around 0:

Plot[rats /. b -> 1.2 // Evaluate, {d, -1, 1},
  PlotStyle -> {{Red}, {Blue}, {Green}}, Axes -> False, Frame -> True]

It seems that both Plot and ParametricPlot3D are not able to detect this 
discontinuity.  What you see in the unit box is the same thing as the 
vertical line at 0 in my Plot example above.

We can fix this by specifying the Exclusions option manually:

Plot[rats /. b -> 1.2 // Evaluate, {d, -1, 1},
  PlotStyle -> {{Red}, {Blue}, {Green}}, Axes -> False, Frame -> True,
  Exclusions -> {0}]

For ParemetricPlot3D, this is done as follows:

unitBox = {{-1, 1}, {-1, 1}, {-1, 1}}; (* avoid typing *)

ParametricPlot3D[rats, {b, -1, 1}, {d, -1, 1},
  PlotRange -> 10 unitBox, MaxRecursion -> 2, PlotPoints -> 40,
  Exclusions -> {b == 0, d == 0}]

If you change the plot range to 1 unitBox (instead of 10), you get an 
empty plot.

Note that I needed to limit MaxRecursion and PlotPoints manually, 
otherwise my machine would run out of memory and freeze due to disk 
swapping...

Alternatively we can chop up the parameter range into four pieces by 
hand, like this:

With[{pr = 10 unitBox},
  Show[
   ParametricPlot3D[rats, {b, 0, 1}, {d, 0, 1}, PlotRange -> pr],
   ParametricPlot3D[rats, {b, -1, 0}, {d, 0, 1}, PlotRange -> pr],
   ParametricPlot3D[rats, {b, 0, 1}, {d, -1, 0}, PlotRange -> pr],
   ParametricPlot3D[rats, {b, -1, 0}, {d, -1, 0}, PlotRange -> pr]
   ]
  ]

-- 
Szabolcs Horvát
Mma QA site proposal: http://area51.stackexchange.com/proposals/37304



  • Prev by Date: Re: MatrixPower problem
  • Next by Date: Re: Prevent synchronizing a certain symbol between main and parallel
  • Previous by thread: Re: ParametricPlot3D vs Reduce
  • Next by thread: Re: ParametricPlot3D vs Reduce