Derivatives with respect to vectors and matrices expressed as vector and matrix operations

64 views
Skip to first unread message

Kevin Houlihan

unread,
Jan 6, 2017, 2:08:37 AM1/6/17
to sympy
Does SymPy have any builtin functionality for expressive derivatives w.r.t. vectors and matrices as vector and matrix operations?

By "derivative w.r.t. a vector" I mean a vector of derivatives w.r.t. each element. The reason for treating these derivatives differently that just a vector of derivatives is that derivatives w.r.t. a vector often can be more naturally and conveniently expressed as operations on vectors rather than operations on individual elements. The same applies for matrices.

As a simple example of what I'm after:

    |v| indicates the common Cartesian norm of a vector v
    x1 and x2 are points in Cartesian space

    I want the derivative of |x1 - x2| w.r.t. x1 to evaluate to (x1 - x2)/|x1 - x2|.

If this functionality isn't builtin, is there a suggested way to approximate or implement it?

From searching the archives, it looks like this topic has been discussed and is an area being developed but I can't find any posts from within the last year.

I'm not a mathematician or physicist so I may be misusing terminology. Please go ahead and ask for clarification if my intent is unclear. In particular, I don't know if I should be using the word "gradient" here. In the cases I'm familiar with, "gradient" is used in regards to functions of a single vector. What I'm trying to describe here applies to functions of multiple vectors.

Thanks.

Alan Bromborsky

unread,
Jan 11, 2017, 12:33:16 PM1/11/17
to sy...@googlegroups.com
Your example is taking the gradient of a scalar function |x2-x1| and getting a vector function.  See -

https://en.wikipedia.org/wiki/Gradient

My geometric algebra package -

https://github.com/brombo/galgebra

can take the gradient (vector derivative) of a multivector function of which scalars and vectors are examples (see galgebra.pdf in doc section of github link).  Note that the vector derivative of a vector function is not a vector but the sum a scalar and bivector function (see galgebra.pdf).



--
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+unsubscribe@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/cc351e8c-1b16-477b-93a8-64040c471121%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages