Efficient pattern dispatch is hard, particularly when you have associative
and commutative operators.  If we don't care about
associativity/commutitivity then it's fairly doable.  This is the sort of
thing I would build in my spare time if the community actually intended to
use it.


On Fri, Mar 21, 2014 at 8:12 AM, Ondřej Čertík <[email protected]>wrote:

> On Fri, Mar 21, 2014 at 8:45 AM, F. B. <[email protected]> wrote:
> >
> >
> > On Thursday, March 20, 2014 7:17:13 PM UTC+1, Ondřej Čertík wrote:
> >>
> >> Hi Peter,
> >>
> >> I read through your ideas. First of all, I started SymPy as a
> >> theoretical physics student myself,
> >> and I wanted to automate the General Relativity as well as high energy
> >> QFT calculations. I am still
> >> very interested in that, but there are a lot of tough problems and
> >> parts that need to be in place.
> >>
> >
> > The rigorous math approach behind that is indeed tough.
> >
> >> You need to be able to do integrals, handle potentially large
> >> formulas, tensor manipulation and simplification
> >> (e.g. gamma matrices), and so on. It's not easy at all, but we've done
> >> a long progress since the time I started
> >> SymPy in 2007 or so.
> >
> >
> > I had a proposal to view tensors as graphs, possibly using NetworkX to
> > represent the tensor structure (cfr. the book by Cvitanovic)
> >
> >> The best way to get some ideas of what can be done is to look into
> >> existing packages, they are pretty much
> >> all in Mathematica. In fact, most theoretical physicist just use
> >> Mathematica.
> >
> >
> > Many Mathematica packages make heavy usage of pattern dispatch, we don't
> > have such advanced capabilities here in sympy. Mathematica code is
> generally
> > not easily portable, but I wish there will be support for pattern
> dispatch
> > in the future.
> >
> >
> >> So it would be really nice to have the project that you describe. You
> >> should have a look at work done by Francesco Bonazzi
> >> regarding the gamma matrices:
> >>
> >> https://github.com/Upabjojr
> >> https://github.com/sympy/sympy/pull/2601
> >>
> >> He has lots of PRs, closed and open. It's nontrivial. And those are
> >> just the gamma matrices. I think Francesco's goal
> >> could be summarized by your proposal, and he's done many months worth
> >> of work on it already. So the scope is just huge.
> >
> >
> > Gamma matrices themselves are represented by a tensor, with one Lorentz
> > index and two Dirac indices. Technically, calling it a tensor is a bit
> > anomalous, as only the Lorentz index correspond to a tangent/cotangent
> > bundle, while the Dirac indices correspond to the spinor bundle of the
> > spacetime manifold.
> >
> > In any case, we don't have to be exact about the underlying algebra,
> > especially if it is far more complicated than what is really necessary
> for
> > QFT and GR.
> >
> > I once found a Mathematica library with a very simple code to reduce the
> > products of gamma matrices. Indeed they made use of pattern dispatch.
> > Without pattern dispatch, it becomes really complicated. I came to the
> > conclusion that we really need a pattern dispatching mechanism, and one
> > specially suited for SymPy tensors, otherwise all tensor manipulation
> code
> > will end up being a total mess.
>
> Would you mind describing, perhaps in a different thread or a github
> issue, what exactly is needed in the pattern matching?
> Is speed of Python an issue? If so, I'll be happy to work on fast
> pattern matching in csympy. If not, then we just need to improve
> SymPy's pattern matching.
>
> Ondrej
>
> >
> >
> >>
> >>
> >> One of the things is for example just the Feynman diagrams generator
> >> for various Lagrangians.
> >
> >
> > There are already open-source libraries doing this.
> >
> >>
> >> I am sure there must be some
> >> packages that do that, but it'd be nice to integrate this with SymPy
> >> and create nice IPython Notebooks that generate all the correct
> >> diagrams, for example from Peskin & Schroeder.
> >
> >
> > As for SymPy, I would rather focus on the mathematical structure of
> objects
> > representing lagrangians. For example, Lagrangian densities cannot
> currently
> > be represented by tensors, as there is no support for tensor derivative
> > operators yet! What about enabling partial and functional derivatives on
> > tensors? That can easily lead to algebraic criteria to derive the Feynman
> > rules from Lagrangians.
> >
> >> This will be good for
> >> pedagogical reasons, as well as computations. In general,
> >> good applications in my opinion are providing automatic symbolic
> >> solutions to various exercises from books.
> >
> >
> > I guess that everyone hates doing QFT calculations by hand.
> >
> >>
> >> I would suggest you to figure out something, that can be finished
> >> during a summer and that would provide something useful,
> >> on it's own. So that you can create nice examples out of it. Then you
> >> can continue working on some other things after the summer
> >
> >
> > I suggest that you consider the Lie group tensor representations as a
> > possible project only if you have an almost perfect knowledge of the
> theory.
> > It would be nice to link the tensor indices to the corresponding Lie
> group
> > representations, but that requires a project on Lie groups first.
> >
> > By the way, I hope you'll be able to submit your proposal and that your
> > proposal will be accepted!
> >
> > --
> > 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 [email protected].
> > To post to this group, send email to [email protected].
> > Visit this group at http://groups.google.com/group/sympy.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/sympy/67f5e77c-4a31-4b14-a261-66686104ff1d%40googlegroups.com
> .
> >
> > 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/CADDwiVDjncWgRSLG4000kxk2MZzVSrB1cVj8K_HiftWLZrSwgA%40mail.gmail.com
> .
> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAJ8oX-HgrtAT63ebU%3DHyVn%2B29Mzf3VQK6vO%2BV5j_DJfmmhT6jA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to