Opened 4 years ago

Last modified 3 years ago

#19998 new defect

Check for and handle symbolic series in simplify

Reported by: dkrenn Owned by:
Priority: major Milestone: sage-7.4
Component: symbolics Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

sage: (x+1).series(x,2)
1 + 1*x
sage: (x+1).series(x,2).operator() is None
True
sage: (x+1).series(x,2).operands()
[1, x]

Related (maybe a consequence) is

sage: (x+1).series(x,2) - 1
(1 + 1*x) - 1
sage: ((x+1).series(x,2) - 1).simplify()
...
ValueError: The name "1" is not a valid Python identifier.

Change History (2)

comment:1 Changed 4 years ago by rws

It is both a consequence of the special status series have in GiNaC. As to the latter, the documentation notes you need to apply series again for getting results:

sage: (x+1).series(x,2)
1 + 1*x
sage: _-1
(1 + 1*x) - 1
sage: _.series(x,2)
1*x

comment:2 Changed 3 years ago by rws

  • Milestone changed from sage-7.1 to sage-7.4
  • Summary changed from missing operator in symbolic series to Check for and handle symbolic series in simplify

The best way to give users what they want---apart from always automatically applying the series operator---would be to apply it in simplify() if the expression has a series, i.e., ((x+1).series(x,2) - 1).simplify() should give 1*x instead of an exception. This means that the operator to-be-applied should have as precision the min of all operators precisions in the expression.

Last edited 3 years ago by rws (previous) (diff)
Note: See TracTickets for help on using tickets.