Opened 15 years ago
Closed 15 years ago
#1578 closed enhancement (fixed)
[with bundle, needs review] Make polynomial .diff() accept optional argument times for repeated differentiation.
Reported by: | ncalexan | Owned by: | ncalexan |
---|---|---|---|
Priority: | major | Milestone: | sage-2.10.3 |
Component: | commutative algebra | Keywords: | polynomial diff times repeat |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Make polynomial .diff() accept optional argument times for repeated differentiation.
Makes diff do its thing multiple time if requested.
- def diff(self, MPolynomial_libsingular variable, have_ring=True): + def diff(self, MPolynomial_libsingular variable, times=1, have_ring=True):
Attachments (1)
Change History (18)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
Priority: | minor → major |
---|---|
Summary: | [with patch, with bundle] Make polynomial .diff() accept optional argument times for repeated differentiation. → [with broken patch] Make polynomial .diff() accept optional argument times for repeated differentiation. |
comment:3 Changed 15 years ago by
Summary: | [with broken patch] Make polynomial .diff() accept optional argument times for repeated differentiation. → [with bundle] Make polynomial .diff() accept optional argument times for repeated differentiation. |
---|
The failures are okay, since they just have redundant information. I tested things out and all tests passed.
comment:4 Changed 15 years ago by
Summary: | [with bundle] Make polynomial .diff() accept optional argument times for repeated differentiation. → [with bundle, needs rebasing] Make polynomial .diff() accept optional argument times for repeated differentiation. |
---|
comment:5 Changed 15 years ago by
Summary: | [with bundle, needs rebasing] Make polynomial .diff() accept optional argument times for repeated differentiation. → [with bundle] Make polynomial .diff() accept optional argument times for repeated differentiation. |
---|
Changed 15 years ago by
Attachment: | ncalexan-mpoly-diff-times-updated.patch added |
---|
This should be the final version; use this over the two earlier bundles and one earlier patch.
comment:6 Changed 15 years ago by
Summary: | [with bundle] Make polynomial .diff() accept optional argument times for repeated differentiation. → [with bundle, needs review] Make polynomial .diff() accept optional argument times for repeated differentiation. |
---|
I deleted the older patches and bundles.
Cheers,
Michael
comment:7 Changed 15 years ago by
'times' seems like an odd name for the argument--it returns the "times-th derivative"?
comment:8 Changed 15 years ago by
How about accepting monomials instead of variables only. Then x^{2} would encode 2-times x, and x^{2}y^{3} would mean 3-times y and 2-times x.
comment:9 Changed 15 years ago by
I don't know if we implement any, but there are functions such that d^2f/dxdy != d^2 f/dydx
.
However, I think the ability to pass in a monomial is an excellent idea. Perhaps beyond the scope of this patch though.
comment:10 Changed 15 years ago by
Owner: | changed from Martin Albrecht to ncalexan |
---|
comment:11 Changed 15 years ago by
In mathematica, you can pass a list to the differentiate command and the function will be differentiated with respect to successive elements of the list. So maybe something like:
f.diff([x,y,y,x])
could specify differentiating first wrt x, then y, then y, and then x again.
The command in the patch could be invoked as:
f.diff([x]*3)
I agree that f.diff(x,3) looks better, though.
comment:12 Changed 15 years ago by
We should probably note that this is supported by symbolic polynomials already.
sage: x,y=var('x y') sage: f=exp(2*x*y) sage: f.diff(x) 2*y*e^(2*x*y) sage: f.diff(x,x) 4*y^2*e^(2*x*y) sage: f.diff(x,2) 4*y^2*e^(2*x*y) sage: f.diff(x,2,y) 8*x*y^2*e^(2*x*y) + 8*y*e^(2*x*y) sage: f.diff(x,2,y,y) 16*x^2*y^2*e^(2*x*y) + 32*x*y*e^(2*x*y) + 8*e^(2*x*y) sage: f.diff(x,2,y,2) 16*x^2*y^2*e^(2*x*y) + 32*x*y*e^(2*x*y) + 8*e^(2*x*y)
comment:13 Changed 15 years ago by
The patch looks ok to me, looking at the diffs (I have not tried applying it).
comment:15 Changed 15 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
I am closing this since it has been superseded by #753.
comment:16 Changed 15 years ago by
Resolution: | duplicate |
---|---|
Status: | closed → reopened |
comment:17 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
This isn't really a duplicate and I consider this fixed. It looks like a borderline case, so I tend to call those tickets fixed.
Cheers,
Michael
Hmm, bundle and patch might need to be rebased. Sorry.