Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7669

Re: ParametricPlot3D vs Reduce

From Szabolcs Horvát <szhorvat@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: ParametricPlot3D vs Reduce
Date 2012-01-08 09:33 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jebnsd$1ie$1@smc.vnet.net> (permalink)
References <je96dj$j22$1@smc.vnet.net>

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

ParametricPlot3D vs Reduce Andrzej Kozlowski <akozlowski@gmail.com> - 2012-01-07 10:22 +0000
  Re: ParametricPlot3D vs Reduce Szabolcs Horvát <szhorvat@gmail.com> - 2012-01-08 09:33 +0000
  Re: ParametricPlot3D vs Reduce Andrzej Kozlowski <akoz@mimuw.edu.pl> - 2012-01-08 09:33 +0000

csiph-web