In [8]: A[i].diff(A[j])
Out[8]:
δ
i,j
In [9]: /type _
Out[9]: KroneckerDelta
In [6]: sin(A[i]).series(A[i])
Out[6]:
3 5
A[i] A[i] ⎛ 6⎞
A[i] - ───── + ───── + O⎝A[i] ⎠
6 120
In [7]: sin(A[i]).series(A[j])
Out[7]: sin(A[i])
In [15]: f(x).diff(f(x))
Out[15]: 1
In [17]: f(x).diff(f(y))
Out[17]: 0
In [18]: f(x).has(f(x))
Out[18]: True
In [19]: f(x).has(f(y))
Out[19]: False
Concerning functions, a similar problem could arise:
In [15]: f(x).diff(f(x))
Out[15]: 1
In [17]: f(x).diff(f(y))
Out[17]: 0
I think that output 17 should be a Dirac delta function: DiracDelta(x - y). What do you think?
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/5c543674-9a8f-461e-955b-44ddc8220476%40googlegroups.com.
IMHO, has() specifically should operate symbolically (no knowledge of mathematics).
This old pull request seems relevant here https://github.com/sympy/sympy/pull/7437. I think having methods for objects to tell how to differentiate themselves is better than hacking around the implementation details of the current implementation.I think f(x).diff(f(y)) should return 0, for the same reason that x.diff(y) should return 0. We've had some in-depth discussions on what differentiating with respect to a function should mean in SymPy, and the thing we agreed on is that expr.diff(f(x)) should be the same as expr.xreplace({f(x): y}).diff(y).xreplace({y: f(x)}). Specifically, xreplace means it only looks at things structurally.
>>> A = Indexed("A")
>>> A[i].diff(A[j])
KroneckerDelta(i, j)
>>> B = Indexed("B", continuous=True)
>>> var("x, y", real=True)
>>> B[x].diff(B[y])
DiracDelta(x - y)
Kalevi, I think that generalizing the Dirac delta to complex numbers is a bit out of scope. Besides, do SymPy users really need it?
On Tuesday, 19 July 2016 20:49:19 UTC+2, Aaron Meurer wrote:IMHO, has() specifically should operate symbolically (no knowledge of mathematics).
Well, it's not really about knowledge of mathematics. It's about matching the unapplied element or the element applied with another argument.
This old pull request seems relevant here https://github.com/sympy/sympy/pull/7437. I think having methods for objects to tell how to differentiate themselves is better than hacking around the implementation details of the current implementation.I think f(x).diff(f(y)) should return 0, for the same reason that x.diff(y) should return 0. We've had some in-depth discussions on what differentiating with respect to a function should mean in SymPy, and the thing we agreed on is that expr.diff(f(x)) should be the same as expr.xreplace({f(x): y}).diff(y).xreplace({y: f(x)}). Specifically, xreplace means it only looks at things structurally.
OK, what about extending Indexed to support continuous indexing? Indexed is meant to represent a set of symbols, I think we could add a continuous=True/False option defaulting to False and have something like this:
>>> A = Indexed("A")
>>> A[i].diff(A[j])
KroneckerDelta(i, j)
>>> B = Indexed("B", continuous=True)
>>> var("x, y", real=True)
>>> B[x].diff(B[y])
DiracDelta(x - y)
The KroneckerDelta is already in the development branch.
Kalevi, I think that generalizing the Dirac delta to complex numbers is a bit out of scope. Besides, do SymPy users really need it?
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/2b2f5dac-01d8-44f3-942c-dfb301757dcd%40googlegroups.com.