For Programmers: Free Programming Magazines  


Home > Archive > Mathematica > December 2006 > Bug or feature ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Bug or feature ?
Giovanni Resta

2006-12-22, 8:11 am

Please, try this with Mathematica (5.2):

<< Graphics`Graphics`

PolarPlot[Sin[t]^2 Cos[t]^2, {t, 0, 2Pi}]

PolarPlot[Sin[t]^2 Cos[t]^2, {t, 0, 21}]

compare the two graphics.

In the second (t is between zero and twentyone)
I got a spurios segment between 3rd and 4th quadrants.

Can you tell me why ?

(Btw, I got this just playing for one minute or two
with PolarPlot. The "21" was a typo...)

g.

Steve Luttrell

2006-12-23, 8:11 am

Evaluate this

PlotPoints /. Options[PolarPlot]

to find that the default number of points used to generate the plot is 25.

You can fix your problem by overriding the default with a larger value.

For instance:

PolarPlot[Sin[t]^2 Cos[t]^2, {t, 0, 21},PlotPoints->100]

Steve Luttrell
West Malvern, UK

"Giovanni Resta" <g.restaxxx@cutTheXXXiit.cnr.it> wrote in message
news:emggb8$2i1$1@smc.vnet.net...
> Please, try this with Mathematica (5.2):
>
> << Graphics`Graphics`
>
> PolarPlot[Sin[t]^2 Cos[t]^2, {t, 0, 2Pi}]
>
> PolarPlot[Sin[t]^2 Cos[t]^2, {t, 0, 21}]
>
> compare the two graphics.
>
> In the second (t is between zero and twentyone)
> I got a spurios segment between 3rd and 4th quadrants.
>
> Can you tell me why ?
>
> (Btw, I got this just playing for one minute or two
> with PolarPlot. The "21" was a typo...)
>
> g.
>



Steve Luttrell

2006-12-27, 4:19 am

I should have started my previous reply (see history below) with the
following:

<< Graphics`Graphics`

Steve Luttrell
West Malvern, UK

"Steve Luttrell" <steve_usenet@_removemefirst_luttrell.org.uk> wrote in
message news:emj3tj$krc$1@smc.vnet.net...
> Evaluate this
>
> PlotPoints /. Options[PolarPlot]
>
> to find that the default number of points used to generate the plot is 25.
>
> You can fix your problem by overriding the default with a larger value.
>
> For instance:
>
> PolarPlot[Sin[t]^2 Cos[t]^2, {t, 0, 21},PlotPoints->100]
>
> Steve Luttrell
> West Malvern, UK
>
> "Giovanni Resta" <g.restaxxx@cutTheXXXiit.cnr.it> wrote in message
> news:emggb8$2i1$1@smc.vnet.net...
>
>



David Annetts

2006-12-28, 8:08 am

Hi Giovanni,

> Please, try this with Mathematica (5.2):
> << Graphics`Graphics`
>
> PolarPlot[Sin[t]^2 Cos[t]^2, {t, 0, 2Pi}]
>
> PolarPlot[Sin[t]^2 Cos[t]^2, {t, 0, 21}]
>
> compare the two graphics.
>
> In the second (t is between zero and twentyone) I got a
> spurios segment between 3rd and 4th quadrants.
>
> Can you tell me why ?
>
> (Btw, I got this just playing for one minute or two with
> PolarPlot. The "21" was a typo...)


It's a feature!

The effect you see is caused by not sampling your function finely enough.
You can get another spurious segment using

PolarPlot[Sin[t]^2 Cos[t]^2, {t, 0, 21}, PlotPoints -> 13]

And this suggests the cure ....

Increasing the number of plot points results in a correct plot.
Interestingly, reducing it (from the default of 25) also works (eg
PlotPoints->20) provided you don't hit a pathological value like (eg) 13.

For effects like this, the cure usually lies in fine tuning any of the
values of PlotPoints, MaxBend or PlotDivision. For another feature, look at


PolarPlot[Sin[t]^2 Cos[t]^2, {t, 0, 21}, PlotDivision -> 4].

Regards,

Dave.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com