The SymPy master branch has been recently updated to handle derivatives of 
Indexed objects. They have the peculiarity of generating a Kronecker delta:

In [8]: A[i].diff(A[j])
Out[8]: 
δ   
 i,j

In [9]: /type _
Out[9]: KroneckerDelta


The solution involved some hacks in the differentiation routine, especially 
to prevent the *.has( )* method from returning *False*, thus implying a 
null result to the derivative (if the derivation variable is not present, 
derivative is zero).

In general, *.has( )* is used quite often. A recent fix 
<https://github.com/sympy/sympy/pull/11408> to the series expansion does 
not produce a series expansion with Kronecker delta because of *.has( )*:


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])


I was wondering, is it sound to overload *.has( ) *in order to return 
*A[i].has(A[j]) 
*===> True ?

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?

In [18]: f(x).has(f(x))
Out[18]: True

In [19]: f(x).has(f(y))
Out[19]: False

Here also, output 19 could be changed to True, as *f(x)* derived by *f(y) 
*would 
now be nonzero.

What do you think? Shall we proceed this way?

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/b05ebb77-ccc9-4405-96e1-c42bcafab531%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to