Open
Description
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.
CC: @orlitzky
Component: calculus
Author: Daniel Gulotta, Vincent Delecroix
Branch/Commit: u/vdelecroix/20812 @ 04dbe4c
Issue created by migration from https://trac.sagemath.org/ticket/20812