In the last few minutes I was codediving in core/function.py. It is just too complicated, and I feel it would be a bad idea if I restart all this work before we address the issues mentioned at the header of the file. I will send a pull request in few hours with a simpler implementation of what I had in my mind that might be less dependent on the idea of MatrixFunction.
I will just subclass MatrixSymbol into DiracMatrix and the symbol will play the role of an argument. TLDR: I will approach the problem without implementing MatrixFunction. On 1 November 2012 19:06, Matthew Rocklin <[email protected]> wrote: > I've never dealt with SymPy functions so I'm not sure how to answer the > Call/Apply object. If you explain it more I'll try to say something > intelligent-sounding. > > Regarding "is this good enough". > 1. You'll also need to specify the shape of the resultant matrix > 2. I wouldn't define a MatrixFunction is a MatrixExpr. > > Are MatrixExprs going to be sufficiently general for your usecase? You and I > tend to think at different levels of mathematical abstraction. > > There are a couple of recent pull requests that might serve as models for > what has been done before > Adjoint - https://github.com/sympy/sympy/pull/1609 > Hadamard - https://github.com/sympy/sympy/pull/1608 > > > On Thu, Nov 1, 2012 at 12:58 PM, Stefan Krastanov > <[email protected]> wrote: >> >> Or is it better to have a Call() or Apply() object? >> >> On 1 November 2012 18:55, Stefan Krastanov <[email protected]> >> wrote: >> > for instance, is this good enough >> > >> > class MatrixFunction(MatSymbol): >> > def call(self, arg): >> > return MatrixEvaluatedFunction(self, arg) >> > >> > class MatrixEvaluatedFunction(MatExpr): >> > like symbol but with an additional argument >> > >> > On 1 November 2012 18:50, Stefan Krastanov <[email protected]> >> > wrote: >> >> For me it will only be a tree node. I would like to have rules like: >> >> >> >> Trace( product of three DiracMatrixFunction ) -> 0 >> >> DiracMatrixFunction(x)*DiracMatrixFunction(y) -> >> >> Kronecker(x,y)*Identity >> >> >> >> On 1 November 2012 18:47, Matthew Rocklin <[email protected]> wrote: >> >>> We do not have a MatrixFunction in MatrixExprs but it would be >> >>> relatively >> >>> simple to make one. What sort of logic would you want it to support? >> >>> >> >>> >> >>> On Thu, Nov 1, 2012 at 12:42 PM, Stefan Krastanov >> >>> <[email protected]> wrote: >> >>>> >> >>>> Is there a way to represent something like M(x) where x is a Symbol >> >>>> and M(x) is something matrix-like. >> >>>> >> >>>> Maybe a MatrixSymbol with a second argument (i.e. M(x) is >> >>>> MatrixSymbol('M', 'x'))? >> >>>> >> >>>> Or something mimicking the Function classes in the core. But I hate >> >>>> all the magic with the metaclasses. It seems excessively complicated. >> >>>> >> >>>> I need this in order to work out some algorithms for simplification >> >>>> of >> >>>> Dirac algebra (gamma matrices) expressions. I was thinking about >> >>>> using >> >>>> the new rewrite rules module. >> >>>> >> >>>> -- >> >>>> 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. >> > > -- > 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.
