Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7627 > unrolled thread
| Started by | Andrzej Kozlowski <akozlowski@gmail.com> |
|---|---|
| First post | 2012-01-07 10:22 +0000 |
| Last post | 2012-01-08 09:33 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
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
| From | Andrzej Kozlowski <akozlowski@gmail.com> |
|---|---|
| Date | 2012-01-07 10:22 +0000 |
| Subject | ParametricPlot3D vs Reduce |
| Message-ID | <je96dj$j22$1@smc.vnet.net> |
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?
Andrzej Kozlowski
[toc] | [next] | [standalone]
| From | Szabolcs Horvát <szhorvat@gmail.com> |
|---|---|
| Date | 2012-01-08 09:33 +0000 |
| Message-ID | <jebnsd$1ie$1@smc.vnet.net> |
| In reply to | #7627 |
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
[toc] | [prev] | [next] | [standalone]
| From | Andrzej Kozlowski <akoz@mimuw.edu.pl> |
|---|---|
| Date | 2012-01-08 09:33 +0000 |
| Message-ID | <jebntc$1il$1@smc.vnet.net> |
| In reply to | #7627 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web