#13720: Scale legendre_P to [a,b]
-------------------------+-------------------------------------------------
Reporter: mjo | Owner: burcin
Type: | Status: needs_work
enhancement | Milestone: sage-5.13
Priority: major | Resolution:
Component: | Merged in:
symbolics | Reviewers: Francis Clarke, Karl-Dieter
Keywords: | Crisman
Authors: | Work issues:
Michael Orlitzky | Commit:
Report Upstream: N/A | Stopgaps:
Branch: |
Dependencies: |
-------------------------+-------------------------------------------------
Changes (by fwclarke):
* status: needs_review => needs_work
Comment:
I really don't understand why `a` and `b` get converted into symbolic
expressions. This has some very strange consequences, e.g.,
{{{
sage: legendre_P(3, 7, -1/2, 1/2).parent()
Symbolic Ring
}}}
It is my understanding that coercion should arrange that the parent of an
expression is as close as possible to the parents of the constituant
parts. It is thus wrong to force (almost) everything into the Symbolic
Ring.
But anyway, I'm afraid I still prefer my version of the code: (1) for its
simplicity (having 3 local functions, two of them only used once, seems
far too over-elaborate); (2) my code is significantly faster.
If you don't like that then something like
{{{
if a == -1 and b == 1:
_init()
return sage_eval(maxima.eval('legendre_p(%s,x)'%ZZ(n)),
locals={'x':x})
else:
return legendre_P(n, (2*x - a - b)/(b - a), -1, 1)
}}}
would be a very simple change to the existing code which avoids
'reinventing the wheel'. This would also have the advantage that an
almost identical change would provide scaled versions for the the Legendre
functions `legendre_Q` of the second kind. However the maxima code is
very slow.
Incidentally, in all cases there needs to be a check to see if `a == b`.
--
Ticket URL: <http://trac.sagemath.org/ticket/13720#comment:18>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.