#4102: make bessel_J symbolic
----------------------------------+-----------------------------------------
Reporter: jwmerrill | Owner: burcin
Type: enhancement | Status: new
Priority: major | Milestone: sage-5.6
Component: calculus | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Benjamin Jones | Merged in:
Dependencies: | Stopgaps:
----------------------------------+-----------------------------------------
Comment (by benjaminfjones):
Replying to [comment:14 burcin]:
Thanks for looking at it!
> Thanks for the patch. Bessel functions are symbolic with so few lines of
code. Amazing. :)
>
> I like the metaclass idea. That never occured to me before as an option
for functions with parameters, like the order here. I have a few
questions:
>
> - what is the advantage of creating a new symbolic function for each
(type, order) pair, instead of having a generic function for each type
that takes the order as a parameter? The latter would be similar to the
design of the `psi()` function in GiNaC/Pynac.
The advantage I had in mind was just code reuse. In hindsight though, this
approach makes the code more complicated and less maintainable that it
needs to be. I'm going to refactor it into four generic functions in
`sage/functions/bessel.py` as you suggest.
> - wouldn't this approach make life harder if in the future we want to
add exact evaluation method for Bessel_J only?
Good point..
> I am also concerned about blowing up the symbolic function registry with
these instances. Note that we keep an entry in a C++ list with a pointer
to all the possible custom methods, and a Python dictionary with a
function -> Pynac id mapping for each subclass of `BuiltinFunction` that
is instantiated.
Also a good point. This occurred to me, but I didn't think through the
consequences very much. I can see it being a problem if a user can
inadvertently create a very large number of symbolic functions at runtime
by doing something innocuous like:
{{{
sage: point([ (k, Bessel(k, 'J')(pi)) for k in range(1000) ])
... (1000 new symbolic function classes created!)
}}}
> BTW, I suggest moving this code to a new file
`sage/functions/bessel.py`.
Good idea. New patch coming soon...
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4102#comment:16>
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.