#11225: improve piecewise plotting
------------------------+---------------------------------------------------
Reporter: kcrisman | Owner: jason, was
Type: defect | Status: new
Priority: major | Milestone:
Component: graphics | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
------------------------+---------------------------------------------------
Description changed by kcrisman:
Old description:
> Until we actually totally rewrite piecewise functions, we should improve
> some things.
>
> For concreteness, here is one thing that should work but doesn't. I'm
> sure there are more - add to this list, and then whatever isn't fixed in
> this ticket can be moved to another ticket. I just want to make sure
> they're listed in one place, not ten tickets.
>
> List:
> * plotting more than one
> {{{
> sage: f = Piecewise([[(0,1),x^3], [(1,2),x^2]], x)
> sage: plot([f,x^3],(x,0,2))
> }}}
> * plotting a product of a piecewise with a symbolic (well, the problem
> is multiplying the two, but still worth putting here - see
> [http://groups.google.com/group/sage-
> support/browse_thread/thread/7357d08529de32dd this sage-support thread])
> * Maybe unify with `plot_step_function`, which currently is sort of its
> own thing?
> * In this example:
> {{{
> sage: zero_func(x)=0
> sage: g = Piecewise([[(-1000,1),zero_func],[(1,1000),(x-1)^3]],x)
> sage: G = g.plot()
> sage: G.show(xmin=-5,xmax=5,ymax=100)
> sage: g(1)
> 0
> }}}
> * You can use oo (infinity) for endpoints, but then the plot code for
> Piecewise gets screwed up.
> * You can try putting in zero instead of defining this new zero
> function, but then g(1) and g(-1) etc. won't work.
> * You can try using extend_by_zero to make the zero part, but it gives
> the same problem.
> * You can plot without xmin and xmax, but that gives the whole
> function.
> * You can plot without ymax, but that gives the range further out than
> you want.
> * You can try plot(g), but that turns out to uncover a very strange
> error that may or may not be a bug.
New description:
Until we actually totally rewrite piecewise functions, we should improve
some things.
For concreteness, here is one thing that should work but doesn't. I'm sure
there are more - add to this list, and then whatever isn't fixed in this
ticket can be moved to another ticket. I just want to make sure they're
listed in one place, not ten tickets.
List:
* plotting more than one
{{{
sage: f = Piecewise([[(0,1),x^3], [(1,2),x^2]], x)
sage: plot([f,x^3],(x,0,2))
}}}
* plotting a product of a piecewise with a symbolic (well, the problem is
multiplying the two, but still worth putting here - see
[http://groups.google.com/group/sage-
support/browse_thread/thread/7357d08529de32dd this sage-support thread])
* Maybe unify with `plot_step_function`, which currently is sort of its
own thing?
* In this example:
{{{
sage: zero_func(x)=0
sage: g = Piecewise([[(-1000,1),zero_func],[(1,1000),(x-1)^3]],x)
sage: G = g.plot()
sage: G.show(xmin=-5,xmax=5,ymax=100)
sage: g(1)
0
}}}
* You can use oo (infinity) for endpoints, but then the plot code for
Piecewise gets screwed up.
* You can try putting in zero instead of defining this new zero
function, but then g(1) and g(-1) etc. won't work.
* You can try using extend_by_zero to make the zero part, but it gives
the same problem.
* You can plot without xmin and xmax, but that gives the whole
function.
* You can plot without ymax, but that gives the range further out than
you want.
* You can try plot(g), but that turns out to uncover a very strange
error that may or may not be a bug.
See also #1773.
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11225#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
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.