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). On Fri, Jan 6, 2017 at 12:41 AM, Kevin Houlihan <kho...@gmail.com> wrote: > 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. > > -- > 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+unsubscr...@googlegroups.com. > To post to this group, send email to sympy@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 > <https://groups.google.com/d/msgid/sympy/cc351e8c-1b16-477b-93a8-64040c471121%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to sympy@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/CALOxT-%3Dvz%3DLMbiAMLyjX6h8K1ftDdU9%3DGtQGqBG2S2BM6tb6ZA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.