see below. On Sun, Apr 15, 2012 at 17:44, Matthew Rocklin <[email protected]> wrote:
> That's really cool work. It would be great to see these sorts of things > integrated back into SymPy. I'm not sure any of the other major CASs have > anything like this. Definitely check out the MatrixExpr classes in the > development branch. This work is new and could really use your contribution. > > I suspect that you could easily accomplish this if you put the rules you > state in your MATRIX_DIFF_RULES dict into a new _eval_derivative method in > each of the relevant MatrixExper classes (MatAdd, MatMul, Transpose, > Inverse) as Aaron suggests. > > Do we have a class to represent (∂X)? > > I'm happy to help if you have questions about MatrixExprs. > > On Sun, Apr 15, 2012 at 2:59 PM, Aaron Meurer <[email protected]> wrote: > >> Hi. >> >> We do plan to do this. See >> http://code.google.com/p/sympy/issues/detail?id=2759. No present work >> is being done on it now, though. >> >> We have MatrixSymbol objects, which already implement all the >> boilerplate stuff like transposes (it's been implemented since the >> last release, so you'll have to use the git master to use it). All >> that needs to be done is to properly implement the ._eval_derivative >> methods. >> >> If you can help start implementing these rules, that would be great. >> Let us know if you need any help with the git workflow. We have an >> extensive guide at >> https://github.com/sympy/sympy/wiki/development-workflow. >> >> Aaron Meurer >> >> On Sun, Apr 15, 2012 at 11:16 AM, Valentin Z >> <[email protected]> wrote: >> > Hi everyone, >> > >> > I have seen an ancient thread on this forum about automatic symbolic >> > matrix differentiation, to have sympy compute expressions like: >> > >> > ∂(XY) = (∂X)Y + X(∂Y) >> > d( A' ) = d ( A ) ' (transpose) >> > etc... >> > >> > This is cool, and very welcome, but some questions: --- What is meant exactly above with "matrix derivatives" There are multiple cases: Derivative of matrix as a matrix function of a scalar argument, as matrix funtion of a vector argument, or as matrix function of a matrix argument. Concentrating on the last case: The matrix derivative can be seen as a collection of tyhe set of all partial derivatives, and this can be packaged into a matrix in various ways. In the following I am following the book by Kollo and von Rosen, "Advanced Multivariate Statistics with Matrices", Springer. They give various forms of "the" Matrix derivative, in two main classes: Organized by Kronecker products or by using the vec operator, and ends up favouring the last. One definition (the one they favour) is \frac{d Y}{d X} = \frac{\partila}{\partial \vec{X}} \vec^T {Y} which, when X is a p\times q - matrix, Y a r\times s - matrix, is a (pq)\times (rs) - matrix. An alternative definition (Neudecker, 1969) is \frac{d Y}{d X} = (\frac{\partia}{\partial \vec X} )^T \otimes \vec Y where the \otimes symbol representa a Kronecker product. An example of a Matrix differentiation result using the first of this definitions, is \frac{d A^T X}{d X} = I_q \otimes A where A is a constant matrix. Which of (all) these definitions should be used in sympy (should it be possible to ask for which def to use? Kjetil > > Are there still projects in this direction ? What has been decided >> > about a symbolic matrix class (where one matrix = one letter ) ? >> > >> > I just implemented my own matrix differentiator method but it is >> > something built kind of "beside" the rest of sympy (with its own >> > printing and latex methods). However it could be easily added to the >> > package: >> > >> > >> http://zulko.wordpress.com/2012/04/15/symbolic-matrix-differentiation-with-sympy/ >> > >> > Hope it helps until an 'official' solution comes to light :) >> > >> > Cheers, >> > >> > Valentin >> > >> > -- >> > 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. >> > >> >> -- >> 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. >> >> > -- > 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. > -- "If you want a picture of the future - imagine a boot stamping on the human face - forever." George Orwell (1984) -- 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.
