Opened 23 months ago

Last modified 22 months ago

#24554 needs_review defect

Refactoring in Chebyshev functions

Reported by: rws Owned by:
Priority: major Milestone: sage-8.2
Component: symbolics Keywords:
Cc: Merged in:
Authors: Ralf Stephan Reviewers:
Report Upstream: N/A Work issues:
Branch: u/rws/24554 (Commits) Commit: 957ce14029a9ce8878fa66444f50f9b0372e7fa8
Dependencies: Stopgaps:

Description (last modified by rws)

While other orthogonal polynomial functions (as well as almost all other symbolic functions) are simply BuiltinFunctions or GinacFunctions this ticket suffers from the fact that the Cheby functions in Sage allow the algorithm keyword (by using a __call__ method in the superclass). The way such polymorphisms are resolved in other functions is by having the interface (the callable global function chebyshev_T()) dispatching on the keyword, especially because doctests involving all kind of Sage objects as function argument are expected to work eternally.

The goal of this ticket is to move the __call__ method out of the Function class (as well as other methods used as interface) into a separate interface class; to 2. make the remaining class inherit from BuiltinFunction and, 3., to remove the ChebyshevFunction superclass as it is then no longer used.

Change History (12)

comment:1 Changed 23 months ago by rws

  • Description modified (diff)

comment:2 Changed 23 months ago by rws

The usage chebyshev_T(...algorithm='pari' silently uses normal evaluation because there is no _eval_pari_ member, so Pari was never supported.

comment:3 Changed 23 months ago by rws

  • Description modified (diff)
  • Summary changed from Remove __call__() usage in Chebyshev functions to Refactoring in Chebyshev functions

comment:4 Changed 23 months ago by rws

  • Description modified (diff)

comment:5 Changed 23 months ago by rws

Also the usage chebyshev_T(...algorithm='maxima') used normal evaluation. Maxima returns a polynomial in (x-1) which probably is useful so I'm changing doctests. In a later step this could be renamed to a more descriptive name and computed by Sage.

Last edited 23 months ago by rws (previous) (diff)

comment:6 Changed 23 months ago by rws

Also eval_formula() should become algorithm='hypergeometric'. The Maxima "algorithm" is variant of it, see https://en.wikipedia.org/wiki/Chebyshev_polynomials#Explicit_expressions

comment:7 Changed 23 months ago by rws

  • Branch set to u/rws/remove___call_____usage_in_chebyshev_functions

comment:8 Changed 23 months ago by git

  • Commit set to 25823302e3769f6502fc208d72bb6635d48eeeb9

Branch pushed to git repo; I updated commit sha1. New commits:

23190a624554: refactor chebyshev_U
258233024554: remove ChebyshevFunction

comment:9 Changed 23 months ago by rws

  • Authors set to Ralf Stephan
  • Status changed from new to needs_review

comment:10 Changed 22 months ago by rws

  • Status changed from needs_review to needs_work

Docs fail to build, doctest errors in three files:

  • sage -t --long src/sage/rings/polynomial/polynomial_element.pyx # 6 doctests failed
  • sage -t --long src/sage/rings/number_field/splitting_field.py # 2 doctests failed
  • sage -t --long src/sage/graphs/bipartite_graph.py # 1 doctest failed

comment:11 Changed 22 months ago by rws

  • Branch changed from u/rws/remove___call_____usage_in_chebyshev_functions to u/rws/24554

comment:12 Changed 22 months ago by rws

  • Commit changed from 25823302e3769f6502fc208d72bb6635d48eeeb9 to 957ce14029a9ce8878fa66444f50f9b0372e7fa8
  • Status changed from needs_work to needs_review

New commits:

957ce1424554: Refactoring in Chebyshev functions
Note: See TracTickets for help on using tickets.