Skip to content

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

Open
@sagetrac-dgulotta

Description

@sagetrac-dgulotta

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions