#7614: change plot to use fast_callable
------------------------+---------------------------------------------------
Reporter: was | Owner: was
Type: defect | Status: new
Priority: major | Milestone: sage-4.3
Component: graphics | Keywords:
Work_issues: | Author:
Upstream: N/A | Reviewer:
Merged: |
------------------------+---------------------------------------------------
Old description:
> {{{
>
> On Sun, Dec 6, 2009 at 4:51 PM, Michel <[email protected]> wrote:
> > Thanks for the reply. But no. The problem is not due to the fact that
> > the function has a singularity. Indeed.
> >
> > plot(20*log(abs((1+I*x)^4),10),(x,0,3))
> >
> > fails with the same error which is incomprehensible to me.
> >
> > On the other hand turning the expression into a lambda function made
> > it possible to plot it. Thanks for this practical advice.
> >
> > I wish someone could explain this rationally to me.
> >
> > 20*log(abs((1+I*x)^4),10)
> >
> > seems to be a perfectly fine symbolic expression so IMHO it should be
> > possible to plot it.
>
> This is a bug. There absolutely no reason that plotting should give the
> error
> "float() argument must be a string or a number".
> We could give an error about not being able to evaluate the function at
> certain
> points. However, the above error is not OK. The error in fact is not
> in plotting
> but in making a fast_float compiled version of the expression:
>
> sage: s = 20*log(abs((1+I*x)^4),10)
> sage: fast_float(s,x)
> Traceback (most recent call last):
> ...
> TypeError: float() argument must be a string or a number
>
> In fact, SAge *should* be using fast_callable, not fast_float. This
> works just fine if you force it manually:
>
> s = 20*log(abs((1+I*x)^4),10)
> plot(fast_callable(s,vars=[x]), (x,0,3))
> [[nice picture as output]]
>
> Many, many thanks for your bug report. It is bug reports from users like
> you that really helps Sage to be a first-rate mathematical software
> system.
>
> }}}
New description:
--
Comment(by mvngu):
From this [http://groups.google.com/group/sage-
support/browse_thread/thread/19de9e09ff948cbc sage-support] thread:
{{{
On Sun, Dec 6, 2009 at 4:51 PM, Michel <[email protected]> wrote:
> Thanks for the reply. But no. The problem is not due to the fact that
> the function has a singularity. Indeed.
>
> plot(20*log(abs((1+I*x)^4),10),(x,0,3))
>
> fails with the same error which is incomprehensible to me.
>
> On the other hand turning the expression into a lambda function made
> it possible to plot it. Thanks for this practical advice.
>
> I wish someone could explain this rationally to me.
>
> 20*log(abs((1+I*x)^4),10)
>
> seems to be a perfectly fine symbolic expression so IMHO it should be
> possible to plot it.
This is a bug. There absolutely no reason that plotting should give the
error
"float() argument must be a string or a number".
We could give an error about not being able to evaluate the function at
certain
points. However, the above error is not OK. The error in fact is not
in plotting
but in making a fast_float compiled version of the expression:
sage: s = 20*log(abs((1+I*x)^4),10)
sage: fast_float(s,x)
Traceback (most recent call last):
...
TypeError: float() argument must be a string or a number
In fact, SAge *should* be using fast_callable, not fast_float. This works
just fine if you force it manually:
s = 20*log(abs((1+I*x)^4),10)
plot(fast_callable(s,vars=[x]), (x,0,3))
[[nice picture as output]]
Many, many thanks for your bug report. It is bug reports from users like
you that really helps Sage to be a first-rate mathematical software
system.
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7614#comment:1>
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.