Opened 4 years ago
Last modified 3 years ago
#24861 needs_work defect
Option to hold for derivative
Reported by:  gh:vaibhavkarve  Owned by:  

Priority:  trivial  Milestone:  sage8.4 
Component:  calculus  Keywords:  hold 
Cc:  Merged in:  
Authors:  Ralf Stephan  Reviewers:  
Report Upstream:  N/A  Work issues:  
Branch:  u/rws/option_to_hold_for_derivative (Commits, GitHub, GitLab)  Commit:  453cf14cdc3615d781d0dcd57daa95b9e45d5b5a 
Dependencies:  Stopgaps: 
Description
It would be nice to have the output of
(x^3).diff(x, hold=True)
look like
$$ \frac{\partial}{\partial x}x^3 $$
Change History (5)
comment:1 Changed 4 years ago by
comment:2 Changed 4 years ago by
 Branch set to u/rws/option_to_hold_for_derivative
comment:3 Changed 4 years ago by
 Commit set to 453cf14cdc3615d781d0dcd57daa95b9e45d5b5a
Branch pushed to git repo; I updated commit sha1. New commits:
453cf14  24861: handle multi diffs

comment:4 Changed 4 years ago by
 Milestone changed from sagefeature to sage8.2
 Status changed from new to needs_review
Thanks for the report. This will be a useful addition to Sage.
comment:5 Changed 3 years ago by
 Milestone changed from sage8.2 to sage8.4
 Status changed from needs_review to needs_work
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)
returnsdiff(x, x^2)
instead of an error. Note also thatlatex((x).diff(x*x, hold=True))
causes a segfault.  The error message
wrong argument in diff
could be made more helpful; perhaps something likeall 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 likelatex((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 ofderivative
. I also noticed a typo in the first line of the docstring as well:this expressions
>this expression
.
Note: See
TracTickets for help on using
tickets.
Although we don't exactly have already a ticket for this, see the related #17445 and #15021.