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:

Status badges

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)

ncalexan-mpoly-diff-times-updated.patch (9.2 KB) - added by ncalexan 15 years ago.
This should be the final version; use this over the two earlier bundles and one earlier patch.

Download all attachments as: .zip

Change History (18)

comment:1 Changed 15 years ago by ncalexan

Hmm, bundle and patch might need to be rebased. Sorry.

comment:2 Changed 15 years ago by Michael Abshoff

Priority: minormajor
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 Mike Hansen

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 Robert Miller

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 ncalexan

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 ncalexan

This should be the final version; use this over the two earlier bundles and one earlier patch.

comment:6 Changed 15 years ago by Michael Abshoff

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 Robert Bradshaw

'times' seems like an odd name for the argument--it returns the "times-th derivative"?

comment:8 Changed 15 years ago by Martin Albrecht

How about accepting monomials instead of variables only. Then x2 would encode 2-times x, and x2y3 would mean 3-times y and 2-times x.

comment:9 Changed 15 years ago by Robert Bradshaw

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 Martin Albrecht

Owner: changed from Martin Albrecht to ncalexan

comment:11 Changed 15 years ago by Jason Grout

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 Jason Grout

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 John Cremona

The patch looks ok to me, looking at the diffs (I have not tried applying it).

comment:14 Changed 15 years ago by David Harvey

there is action on this at #753

comment:15 Changed 15 years ago by David Harvey

Resolution: duplicate
Status: newclosed

I am closing this since it has been superseded by #753.

comment:16 Changed 15 years ago by Michael Abshoff

Resolution: duplicate
Status: closedreopened

comment:17 Changed 15 years ago by Michael Abshoff

Resolution: fixed
Status: reopenedclosed

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

Note: See TracTickets for help on using tickets.