#5438: [with patch, needs work] Incorrect documentation and/or functionality in
plot filling
----------------------+-----------------------------------------------------
Reporter: kcrisman | Owner: kcrisman
Type: defect | Status: assigned
Priority: minor | Milestone: sage-3.4.2
Component: graphics | Keywords: plot fill
----------------------+-----------------------------------------------------
Comment(by kcrisman):
Certainly line 3037 must be the issue. This was done to be consistent
with another place where a delta occurs, which after all had the correct
''mathematical'' version of delta (since the number of plot points is
actually n+1 for the usual definition of n in Riemann sums etc.). I am
sorry I didn't catch this earlier, but my computer consistently times out
testing both calculus.py and plot.py, so I literally cannot catch these
types of failed tests en masse. I should have tried them by hand, though.
Anyway, I don't think it necessarily downgrades the adaptive plotting
significantly. Note that for i=15 in the second example it actually
increases the plot_points by 3! When I run the old code, incidentally, I
get
{{{
sage: [len(generate_plot_points(f, (-pi, pi), adaptive_tolerance=i)) for i
in [0.01, 0.001, 0.0001]]
[35, 51, 112]
}}}
which is better for some, worse for others. Also note that this shows the
test is ''random'' so this should have been caught earlier, unless
current_randstate().python_random().random is set earlier? I'll set
randomize=False for the test.
But really, this is all because of a missed typo on my part. The original
refactoring changed the default plot_points to 5 from 200 just for the
sake of generate_plot_points, even though the plot_points from _plot is
always passed to this in an actual plotting situation, with default
remaining 200. So I will have to go back in and clarify that anyway, in
addition to fixing the doctest. Yes, there will be a smaller number of
points, but I think the randomness makes a big enough swing that it is
better to be mathematically accurate and consistent. E.g.:
Old:
{{{
sage: [len(generate_plot_points(f, (-pi, pi), 200, adaptive_tolerance=i))
for i in [0.01, 0.001, 0.0001]]
[689, 1145, 1978]
sage: [len(generate_plot_points(f, (-pi, pi), 200, adaptive_tolerance=i))
for i in [0.01, 0.001, 0.0001]]
[707, 1138, 2004]
sage: [len(generate_plot_points(f, (-pi, pi), 200, adaptive_tolerance=i))
for i in [0.01, 0.001, 0.0001]]
[704, 1137, 2020]
}}}
New:
{{{
sage: [len(generate_plot_points(f, (-pi, pi), 200, adaptive_tolerance=i))
for i in [0.01, 0.001, 0.0001]]
[704, 1091, 1949]
sage: [len(generate_plot_points(f, (-pi, pi), 200, adaptive_tolerance=i))
for i in [0.01, 0.001, 0.0001]]
[679, 1148, 2015]
sage: [len(generate_plot_points(f, (-pi, pi), 200, adaptive_tolerance=i))
for i in [0.01, 0.001, 0.0001]]
[704, 1121, 1981]
}}}
Old:
{{{
sage: [len(generate_plot_points(f, (-pi, pi), 200, adaptive_recursion=i))
for i in [5, 10, 15]]
[697, 3235, 18312]
sage: [len(generate_plot_points(f, (-pi, pi), 200, adaptive_recursion=i))
for i in [5, 10, 15]]
[693, 3357, 17117]
sage: [len(generate_plot_points(f, (-pi, pi), 200, adaptive_recursion=i))
for i in [5, 10, 15]]
[700, 3815, 25313]
}}}
New:
{{{
sage: [len(generate_plot_points(f, (-pi, pi), 200, adaptive_recursion=i))
for i in [5, 10, 15]]
[691, 3054, 41501]
sage: [len(generate_plot_points(f, (-pi, pi), 200, adaptive_recursion=i))
for i in [5, 10, 15]]
[692, 4039, 18385]
sage: [len(generate_plot_points(f, (-pi, pi), 200, adaptive_recursion=i))
for i in [5, 10, 15]]
[708, 3125, 31209]
}}}
These differences seem negligible to me, given the wide variation in the
randomness. I'll try to get a new patch up soon clarifying all these
things.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5438#comment:9>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---