> Please define what you mean by derivative in terms of a limit.  For
> example if you have a scalar valued function of a vector do you mean the
> gradient.  With regard to a tensor (indexed array in general) what do
> you mean?  If you have a tensor function of multiple vectors or another
> tensor what do you mean?

Hello Aaron and others:
I am trying to produce the symbolic gradient, with sums not expanded.
For example, I was hoping to produce something like the following.
Sorry for the mixed sympy and numpy notation. J is a function that
depends on matrices x and C.  J has an inner sum and an outer sum.  I
am looking for dJ/dC in symbolic form, without the sums evaluated.

N, i, j, K, D, m  = symbols('N i j K D m', integer=True)
i = Idx('i', N)
j = Idx('j', K)

x = IndexedBase('x', shape=(N,D))
C = IndexedBase('C', shape=(N,D))


innerSum = Sum((x[i,:]-C[j,:])**(-2/(m-1), (j,0,K))**(1-m))
J = Sum(innerSum, (i, 0, N))

the result I am looking for is:  partial dJ/ partial dC =

numerator =  2*(x[i,:]-C[j,:])**(-2/(m-1)) * (1-m) * [Sum((x[i,:]-
C[j,:])**(-2/(m-1)), (j,0,K))]**(1-m)
denominator = (x[i,:]-C[j,:]) * (m-1) *  [Sum((x[i,:]-C[j,:])**(-2/
(m-1)), (j,0,K))]
Sum(numerator/denominator, (i,0,N))

In general, the function J might contain multiply, add, transpose, or
sum operators within it.  What is the best way to approach this with
sympy?  I know that it can be done in Mathematica.  Does this example
help?
Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to