#13720: Scale legendre_P to [a,b]
------------------------------------+---------------------------------------
Reporter: mjo | Owner: burcin
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-5.6
Component: symbolics | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Michael Orlitzky | Merged in:
Dependencies: | Stopgaps:
------------------------------------+---------------------------------------
Changes (by fwclarke):
* status: needs_review => needs_work
Comment:
Replying to [comment:4 mjo]:
> I've fixed the variable quoting in the new patch, and allowed the
endpoints a,b to be symbolic. There's also a new test to make sure that
the symbolic endpoints work as expected.
Why force them to be symbolic? Better, surely, to allow anything that
will evaluate and let coercion handle it.
> I haven't heard back, so maybe you bought my reasoning for the affine
transform =)
No, just busy with other things. There is an affine transform in what I
wrote, but it's a transform of the interval [a, b] onto [0, 1] rather than
[-1, 1]. This is simpler, and the Legendre polynomials on the interval
[0, 1] have a simple form.
> I tried this, but it's producing the wrong results. For example,
> {{{
> sage: legendre_P(1, x)
> -1/2*x - 5/2
> }}}
This is what results from using `^` rather than `**` in python. I'm sorry
my proposed code had only been testing in Sage, and therefore was being
prepared. This dealt with, my version does pass all the doctests, is
faster when if the variable is a polynomial generator, and the error
{{{
sage: legendre_P(4, Zmod(5)(1), 3, 6)
...
ArithmeticError: 0^0 is undefined.
}}}
is eliminated. Apologies for mistyping this before.
> The `bool()` casts do have to stay, otherwise the tests just don't work.
Another way of doing this is to introduce a polynomial variable. Thus
{{{
sage: R.<x> = QQ[]
sage: legendre_P(1, x) == x
True
}}}
I know very little about the symbolic side of Sage, but I do find things
like
{{{
sage: SR(1) == SR(1)
1 == 1
}}}
very strange, and confusing when compared with
{{{
sage: 1 == 1
True
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13720#comment:5>
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.