On Sep 11, 9:07 am, "John Cremona" <[EMAIL PROTECTED]> wrote:
> This works:
>
> plot(lambda t:bessel_J(1, t), (1, 10))
>
> so (1) a one-variable function is reequired, and the lambda
> construction creates such a function from the2-variable bessel_J, and
> (2) the range is a tuple (xmin,xmax) .
>
> John Cremona

Is there a fundamental difference between bessel_J and, say, polylog,
for which I can do

sage: plot(polylog(1,x),(x,.1,.9))

and I get a perfectly nice looking plot?

I see that the implementation difference is that polylog is defined in
calculus.py, and is a class that derives from PrimitiveFunction,
whereas bessel_J is defined in special.py and is not a class, but just
a direct function definition.  And the reason you can't do

sage: plot(bessel_J(1, t), (t, 1, 10))

is that you can't partially evaluate a bessel_J function

sage: bessel_J(1,t)
Traceback (click to the left for traceback)
...
TypeError: Unable to convert x
(='1-1/8*t^2+1/192*t^4-1/9216*t^6+1/737280*t^8-1/88473600*t^10+1/1486356\
4800*t^12-1/3329438515200*t^14+1/958878292377600*t^16+O(t^17)') to
real
number.

The lambda trick is certainly a sensible thing to do, but I can see
why it's difficult to guess that you should do that if you're just
thinking about things mathematically, rather than pythonically.

We should think hard about making things easy to partially evaluate.
Why not have all the special functions behave like polylog?
Furthermore, it would ideally be easy for a user to define their own
functions that behave like polylog.

Regards,

JM
--~--~---------~--~----~------------~-------~--~----~
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