Opened 5 years ago

Last modified 4 years ago

#17659 closed enhancement

make symbolic series subclass of Expression — at Version 5

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

Description (last modified by rws)

Making Expression.series create SymbolicSeries (a subclass of Expression) and moving the series code into a separate file series.pyx

  • reflects the fact that expressions and series don't commute
  • allows upcoming fixes that don't clutter Expression methods with if ex.is_a_series():
  • makes for better documentation via having a Symbolic Series ref man page

In refactoring language this is "replace conditional with polymorphism".

Change History (5)

comment:1 Changed 5 years ago by rws

  • Branch set to u/rws/17659

comment:2 Changed 5 years ago by rws

  • Commit set to a4d2084a82b5f9e2ec3d43472181fccf42a19251
  • Status changed from new to needs_review

New commits:

a4d208417659: make symbolic series subclass of Expression

comment:3 follow-up: Changed 5 years ago by nbruin

I have nothing invested in how symbolics and series interact, but I see some immediate problems that would arise from subclassing Expression for a Series type:

  • when does a SymbolicSeries expression get created? The problem is that the SymbolicRing by itself is a rather untyped environment, so how do you know that an object needs to be made in this specialized class
  • How do SymbolicSeries in different variables interact, e.g.:
    F = (1/(x+1))*y+sin(x)*y^2+O(y^3)
    G = (y/(y^2-2)*x + cos(y)*x^2 +O(x^3)
    F+G
    

Is the result a series? If so, in which variable(s)? One solution would be a SymbolicSeriesRing? as a parent, which declares in what variables the series are. I suspect this would be nearly useless for whatever problem the current design tries to solve, though.

comment:4 in reply to: ↑ 3 Changed 5 years ago by rws

Nils, this is not about creating a ring but simple refactoring. No behaviour change.

http://www.refactoring.com/catalog/replaceConditionalWithPolymorphism.html

Replying to nbruin:

I have nothing invested in how symbolics and series interact, but I see some immediate problems that would arise from subclassing Expression for a Series type:

These problems already exist, so nothing is new.

comment:5 Changed 5 years ago by rws

  • Description modified (diff)
Note: See TracTickets for help on using tickets.