Re: ParametricPlot3D vs Reduce
- To: mathgroup at smc.vnet.net
- Subject: [mg124093] Re: ParametricPlot3D vs Reduce
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Sun, 8 Jan 2012 04:29:01 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <je96dj$j22$1@smc.vnet.net> <4F084325.1020903@gmail.com>
Thanks a lot. As I mentioned in my second post on this subject, using RegionFunction also seems to deal with this problem: ParametricPlot3D[rats, {b, -10, 10}, {d, -10, 10}, RegionFunction -> Function[{x, y, z, u, v}, -1 <= x <= 1 && -1 <= y <= 1 && -1 <= z <= 1], AxesLabel -> {"a", "b", "c"}] Andrzej On 7 Jan 2012, at 14:05, Szabolcs Horv=E1t wrote: > 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=E1t > Mma QA site proposal: http://area51.stackexchange.com/proposals/37304