Ticket #2410 (closed defect: fixed)

Opened 9 months ago

Last modified 3 months ago

[with patch, positive review] parametric_plot and constants

Reported by: jbmohler Assigned to: was
Priority: major Milestone: sage-3.1.2
Component: graphics Keywords:
Cc:

Description

This is a companion to #2409

sage: parametric_plot((t^2,t),-12,12)

works as expected, but

sage: parametric_plot((1,t),-12,12)
...
<type 'exceptions.TypeError'>: 'float' object is unsubscriptable

does not.

More generally, I would like to see the following syntax supported

sage: parametric_plot((1,t),(t,-12,12))

which is much cleaner mathematically (no hidden reliance on variable name 't') and is also very analogous to

sage: plot(t,(t,-12,12))

Attachments

plotting-exceptions.patch (1.2 kB) - added by jason on 08/25/2008 02:53:53 PM.
trac_2140.patch (1.2 kB) - added by mhansen on 08/25/2008 08:00:20 PM.

Change History

03/06/2008 06:40:56 PM changed by mabshoff

  • milestone set to sage-2.10.3.

08/25/2008 02:53:43 PM changed by jason

For reference:

parametric_plot3d automatically calls fast_float on its arguments correctly, so parametric_plot3d((1,t,2), (t,-1,3)), for example, just works.

Why are we not calling fast_float on functions in plot() or parametric_plot? Probably because noone has had time to implement it; contour plots and vector plots both do it. I'll open a new ticket.

Here, I'll post a patch which corrects a bug in how exceptions are handled in plot. Currently, the TypeError? that is being triggered is then ignored when plot tries to access the non-existent data point (the data[i][1] line). This changes the error in this case from a nonsensical indexing error to a sensible "Can't call an Integer" error (from trying to evaluate 1(-12).

08/25/2008 02:53:53 PM changed by jason

  • attachment plotting-exceptions.patch added.

08/25/2008 02:54:58 PM changed by jason

  • summary changed from parametric_plot and constants to [with patch, needs review] parametric_plot and constants.

08/25/2008 03:02:22 PM changed by jason

See #3952 for the fast_float request.

08/25/2008 06:59:46 PM changed by mhansen

  • summary changed from [with patch, needs review] parametric_plot and constants to [with patch, positive review] parametric_plot and constants.

The other issues will be fixed in #3952.

08/25/2008 08:00:20 PM changed by mhansen

  • attachment trac_2140.patch added.

08/25/2008 08:00:40 PM changed by mhansen

Apply trac_2140.patch _after_ #3853

08/25/2008 08:44:48 PM changed by mabshoff

  • status changed from new to closed.
  • resolution set to fixed.

Merged trac_2140.patch in Sage 3.1.2.alpha1