Skip to content

fast_float yields infinity when Python does, but should handle bigger numbers #13559

Open
@nthiery

Description

@nthiery

It sounds like the adaptative algorithm fails to find suitable
evaluation points when plotting large functions (like exp) in loglog
scale. In the following example, the exp function gets drawn with only
three points:

sage: plot([n^2,exp(n)], xmin=1, xmax=10^5, ymin=1,ymax=10^10, scale="loglog")
verbose 0 (2397: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 198 points.
verbose 0 (2397: plot.py, generate_plot_points) Last error message: ''

If xmax is replaced by 10^10, the function is not even drawn:

sage: sage: plot([n^2,exp(n)], xmin=1, xmax=10^10, ymin=1,ymax=10^10, scale="loglog")
verbose 0 (2397: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 199 points.
verbose 0 (2397: plot.py, generate_plot_points) Last error message: ''

On the other hand, the equivalent semilogy plot works smoothly:

sage: plot([10^n,exp(10^n)], xmin=0, xmax=5, ymin=1,ymax=10^10, scale="semilogy")
verbose 0 (2397: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 86 points.
verbose 0 (2397: plot.py, generate_plot_points) Last error message: ''

(Such plots are typically useful in classes about algorithmic complexity http://combinat.sagemath.org/doc/thematic_tutorials/agregation-option-calcul-formel/tris_et_complexite.html)

Depends on #15030

CC: @eviatarbach

Component: basic arithmetic

Keywords: agregation

Issue created by migration from https://trac.sagemath.org/ticket/13559

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions