Opened 12 years ago
Closed 12 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: | 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 12 years ago by
comment:2 Changed 12 years ago by
- Priority changed from minor to major
- Summary changed from [with patch, with bundle] Make polynomial .diff() accept optional argument times for repeated differentiation. to [with broken patch] Make polynomial .diff() accept optional argument times for repeated differentiation.
comment:3 Changed 12 years ago by
- Summary changed from [with broken patch] Make polynomial .diff() accept optional argument times for repeated differentiation. to [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 12 years ago by
- Summary changed from [with bundle] Make polynomial .diff() accept optional argument times for repeated differentiation. to [with bundle, needs rebasing] Make polynomial .diff() accept optional argument times for repeated differentiation.
comment:5 Changed 12 years ago by
- Summary changed from [with bundle, needs rebasing] Make polynomial .diff() accept optional argument times for repeated differentiation. to [with bundle] Make polynomial .diff() accept optional argument times for repeated differentiation.
Changed 12 years ago by
This should be the final version; use this over the two earlier bundles and one earlier patch.
comment:6 Changed 12 years ago by
- Summary changed from [with bundle] Make polynomial .diff() accept optional argument times for repeated differentiation. to [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 12 years ago by
'times' seems like an odd name for the argument--it returns the "times-th derivative"?
comment:8 Changed 12 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 12 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 12 years ago by
- Owner changed from malb to ncalexan
comment:11 Changed 12 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 12 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 12 years ago by
The patch looks ok to me, looking at the diffs (I have not tried applying it).
comment:14 Changed 12 years ago by
there is action on this at #753
comment:15 Changed 12 years ago by
- Resolution set to duplicate
- Status changed from new to closed
I am closing this since it has been superseded by #753.
comment:16 Changed 12 years ago by
- Resolution duplicate deleted
- Status changed from closed to reopened
comment:17 Changed 12 years ago by
- Resolution set to fixed
- Status changed from reopened to 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.