Skip to content
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

Option to hold for derivative #24861

Open
vaibhavkarve opened this issue Feb 27, 2018 · 7 comments
Open

Option to hold for derivative #24861

vaibhavkarve opened this issue Feb 27, 2018 · 7 comments

Comments

@vaibhavkarve
Copy link

It would be nice to have the output of

(x^3).diff(x, hold=True)

look like

$$ \frac{\partial}{\partial x}x^3 $$

Component: calculus

Keywords: hold

Author: Ralf Stephan

Branch/Commit: u/rws/option_to_hold_for_derivative @ 453cf14

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

@rwst
Copy link
Contributor

rwst commented Mar 25, 2018

comment:1

Although we don't exactly have already a ticket for this, see the related #17445 and #15021.

@rwst
Copy link
Contributor

rwst commented Mar 25, 2018

Branch: u/rws/option_to_hold_for_derivative

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 25, 2018

Commit: 453cf14

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 25, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

453cf1424861: handle multi diffs

@rwst
Copy link
Contributor

rwst commented Mar 25, 2018

Author: Ralf Stephan

@rwst
Copy link
Contributor

rwst commented Mar 25, 2018

comment:4

Thanks for the report. This will be a useful addition to Sage.

@rwst rwst added this to the sage-8.2 milestone Mar 25, 2018
@rwst rwst removed the t: feature label Mar 25, 2018
@bryangingechen
Copy link
Mannequin

bryangingechen mannequin commented Aug 1, 2018

comment:5

I agree this would be a nice addition; thanks for addressing this. Here are some comments.

In src/sage/functions/other.py:

  • Something like (x).diff(x*x, hold=True) returns diff(x, x^2) instead of an error. Note also that latex((x).diff(x*x, hold=True)) causes a segfault.
  • The error message wrong argument in diff could be made more helpful; perhaps something like all arguments to diff must be symbols or numerical values. This should be tested as well.
  • The LaTeX output should include parentheses around the expression (probably with \left and \right), otherwise something like latex((x^3+y).diff(x,2,y,2, hold=True)) returns {\frac{\partial^{4}}{{\partial x^2}{\partial y^2}} x^{3} + y} which is incorrect.

In src/sage/symbolic/expression.pyx:

  • the hold parameter should be added to the docstring of derivative. I also noticed a typo in the first line of the docstring as well: this expressions -> this expression.

@bryangingechen bryangingechen mannequin modified the milestones: sage-8.2, sage-8.4 Aug 1, 2018
@mkoeppe mkoeppe removed this from the sage-8.4 milestone Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants