Skip to content

derivative(constant vector, x) returns the scalar 0 #15067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ppurka opened this issue Aug 20, 2013 · 1 comment · Fixed by #39451
Closed

derivative(constant vector, x) returns the scalar 0 #15067

ppurka opened this issue Aug 20, 2013 · 1 comment · Fixed by #39451

Comments

@ppurka
Copy link
Member

ppurka commented Aug 20, 2013

See this ask.sagemath question.

u = matrix(1,2,[-1, 1])
derivative(u,x)
0

Expected result: a vector [0 0].

CC: @kcrisman

Component: calculus

Stopgaps: incorrectAnswerMarker

Issue created by migration from https://trac.sagemath.org/ticket/15067

@ppurka ppurka added this to the sage-6.1 milestone Aug 20, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@sagetrac-jakobkroeker
Copy link
Mannequin

sagetrac-jakobkroeker mannequin commented Jul 9, 2016

Stopgaps: incorrectAnswerMarker

@mkoeppe mkoeppe removed this from the sage-6.4 milestone Dec 29, 2022
vbraun pushed a commit to vbraun/sage that referenced this issue Feb 9, 2025
sagemathgh-39451: Fixes incorrect behaviour when taking the derivative of a constant matrix
    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

Fixes sagemath#15067.

Fixed error in the _derivative methods of matrix_dense.pyx and
matrix_sparse.pyx. These functions attempted to call the derivative
method belonging to each element of the matrix. This caused incorrect
behaviour when the element did not have a derivative method. This was
fixed by altering the code to call the derivative function defined in
/src/sage/calculus/functional.py with the element as a parameter,
instead of the derivative method belonging to the element. Doctests were
added to verify this change.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [X] The title is concise and informative.
- [X] The description explains in detail what this PR is about.
- [X] I have linked a relevant issue or discussion.
- [X] I have created tests covering the changes.
- [X] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#39451
Reported by: Caleb Van't Land
Reviewer(s):
vbraun pushed a commit to vbraun/sage that referenced this issue Feb 9, 2025
sagemathgh-39451: Fixes incorrect behaviour when taking the derivative of a constant matrix
    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

Fixes sagemath#15067.

Fixed error in the _derivative methods of matrix_dense.pyx and
matrix_sparse.pyx. These functions attempted to call the derivative
method belonging to each element of the matrix. This caused incorrect
behaviour when the element did not have a derivative method. This was
fixed by altering the code to call the derivative function defined in
/src/sage/calculus/functional.py with the element as a parameter,
instead of the derivative method belonging to the element. Doctests were
added to verify this change.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [X] The title is concise and informative.
- [X] The description explains in detail what this PR is about.
- [X] I have linked a relevant issue or discussion.
- [X] I have created tests covering the changes.
- [X] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#39451
Reported by: Caleb Van't Land
Reviewer(s):
vbraun pushed a commit to vbraun/sage that referenced this issue Feb 10, 2025
sagemathgh-39451: Fixes incorrect behaviour when taking the derivative of a constant matrix
    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

Fixes sagemath#15067.

Fixed error in the _derivative methods of matrix_dense.pyx and
matrix_sparse.pyx. These functions attempted to call the derivative
method belonging to each element of the matrix. This caused incorrect
behaviour when the element did not have a derivative method. This was
fixed by altering the code to call the derivative function defined in
/src/sage/calculus/functional.py with the element as a parameter,
instead of the derivative method belonging to the element. Doctests were
added to verify this change.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [X] The title is concise and informative.
- [X] The description explains in detail what this PR is about.
- [X] I have linked a relevant issue or discussion.
- [X] I have created tests covering the changes.
- [X] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#39451
Reported by: Caleb Van't Land
Reviewer(s):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants