Opened 5 years ago

Last modified 4 years ago

#20812 new enhancement

derivative of integer wrt to variable in polynomial ring should belong to that ring, not symbolic ring

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

Status badges


If I try to take the derivative of an integer (or nonzero rational, or integer mod n), then the result is an element of the symbolic ring:

sage: R.<x>=ZZ[]
sage: derivative(0,x).parent()
Symbolic Ring

It seems like it would be more natural for the returned value to belong to the ring containing x instead.

This may seem kind of pedantic, but it did trip me up when I was working with a list of polynomials, some of which were constant, and things were getting cast to Expression unexpectedly.

I am not particularly familiar with the Sage codebase, but I am attaching a patch that seems to fix the issue.

Attachments (1) (871 bytes) - added by dgulotta 5 years ago.

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by dgulotta

comment:1 Changed 4 years ago by chapoton

If you take care to use the correct zero, this just works:

Univariate Polynomial Ring in x over Integer Ring

But there is room for improvement, for sure.

Note: See TracTickets for help on using tickets.