On 08/25/2008 02:58:07 PM, Jason Grout wrote:
> 
> Jason Grout wrote:
> > Mike Witt wrote:
> >> On 08/21/2008 06:55:48 PM, Joel B. Mohler wrote:
> >>> On Thursday 21 August 2008 01:58:23 pm Mike Witt wrote:
> >>>> I'm looking for a work-around for the situation where I would normally
> >>>> call parametric_plot (or plot, for that matter) with a function, and in
> >>>> some particular case that function turns out to evaluate to a constant.
> >>>>
> >>>> For example:
> >>>>
> >>>> sage: def f(a,b): return e^(a+b*I)
> >>>> ....:
> >>>> sage: parametric_plot([real(f(x,1)),imag(f(x,1))], -pi, pi)
> >>>>
> >>>>   Works as expected
> >>>>
> >>>> sage: parametric_plot([real(f(x,-1)),imag(f(x,-1))], -pi, pi)
> >>>>
> >>>>   Works as expected
> >>>>
> >>>> sage: parametric_plot([real(f(x,0)),imag(f(x,0))], -pi, pi)
> >>>>
> >>>>   Gives a page full of errors, which I interpret to mean that there
> >>>>   was a problem plotting because imag(f(x,0)) evaluates to a constant.
> >>>>
> >>>> I believe that this is the same issue described in:
> >>>>
> >>>> http://trac.sagemath.org/sage_trac/ticket/2410
> >>> I'm the person that entered the trac ticket and the point of that trac 
> >>> ticket 
> >>> is precisely the (mis-)functionality you are describing.   I'm truly 
> >>> mystified by the other responses in this thread.  To me, this is an 
> >>> obvious 
> >>> bug...
> >>>
> >>> --
> >>> Joel
> >> Thanks Joel. I was beginning to wonder if I was nuts. Just to summarize 
> >> what
> >> I've found out so far. The work-arounds suggested by David Joyner, Mike 
> >> Hansen, 
> >> and Carl Witty all work under certain assumptions, but none of the three
> >> provides a completely general fix as far as I can see. Using a combination 
> >> of
> >> the techniques I am able to do what I want. But I am for whatever it's 
> >> worth
> >> I'd certainly like to add my vote that tickets #2409 and #2410 should get
> >> attention. This issue with parametric_plot is certainly *very* confusing
> >> to a newcomer.
> > 
> > 
> > Here's yet another method:
> > 
> > sage: from  sage.ext.fast_eval import fast_float
> > sage: plot(fast_float(1), -1, 2)
> > sage: parametric_plot((fast_float(1),t),-12,12)
> > 
> > 
> > Now, why in the world the plot functions aren't calling fast_float, I 
> > don't know.  I thought that's what they did.  I'm looking into it for a 
> > few minutes, at least.
> >
> 
> Okay, apparently no one has had time to implement it.  Calling 
> fast_float will solve the issue, as it is solved in parametric_plot3d, 
> for example.  The new ticket is #3952.  I've also posted a patch on 
> #2410 which corrects a bug in the exception handling so that you get an 
> sensible exception instead of the nonsensical indexing exception that 
> you get now.
> 
> Thanks,
> 
> Jason

It would be nice if the plotting functions could be fixed. None of
these techniques works (easily) from the user level. Because (in the
general case) you first have to figure out whether each argument is
a literal, a function of a variable, or a constant function -- before
you apply a "fix" to it (eg., you can't take the fast_float of it
if it's a function of the free variable that you're plotting. So, it's
easy to fix a specific plot where you know what you're plotting, but
to write general purpose code, where you don't know what you're
going to be handed ... well, I guess it's not *that* bad or there
would have been more complaints before now. But if Sage is going to
support more "naive" users (like me :-) then things like this will
be a real stumbling block.

Just my opinion of course. And, I guess I don't know exactly what
audience Sage is targeted to. So my comments might or might not
be pertinent.

-Mike


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to