Skip to content

density_plot() is broken with functions involving symbolic expressions #17684

@sagetrac-tmonteil

Description

@sagetrac-tmonteil

As reported on this ask question, the following does not work:

sage: f1(a, b) = 1 - b / a
sage: f2(a, b) = 1 - a / b
sage: def f12(a, b):
....:         if a - b < 0:
....:                 return f1(a, b)
....:         else:
....:                 return f2(a, b)
sage: density_plot(f,(1,2),(1,2))
KeyError: 'text/plain'

While the following works:

sage: f1(a, b) = 1 - b / a
sage: f2(a, b) = 1 - a / b
sage: def f12(a, b):
....:     if a - b < 0:
....:         return RDF(f1(a, b))
....:     else:
....:         return RDF(f2(a, b))
sage: density_plot(f12,(1,2),(1,2))

CC: @kcrisman

Component: graphics

Author: Dave Morris

Branch: bb5a812

Reviewer: Karl-Dieter Crisman

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions