Very Late GSoC application

356 views
Skip to first unread message

Peter Petrov

unread,
Mar 20, 2014, 5:48:39 AM3/20/14
to sy...@googlegroups.com

Hi everyone,

I just found out about GSoC several days ago and it immediately struck me as being amazing. I have been trying to get involved in the open source community for a while now, but haven't been able to "find the time". I am currently in a PhD program working on theoretical physics (string theory), but have been doing quite a lot of tinkering with computer science in general lately and it has been really fascinating. GSoC seems like the exact type of thing to push me and keep me on track to start contributing seriously to open source projects and get my hands dirty with "real" coding. I immediately jumped on the SymPy page and started playing around with the packages. It's a little overwhelming how much is being developed simultaneously, but I am getting a feel for some of the interesting features.

I know it is a long shot to get approved for the GSoC, since I see most people have started working on proposals so early on, but I am still going to try and if it doesn't work I will at least have learned enough to start working on something interesting even without the funding (it would help though, since I will be able to devote more time to it over the summer).

I wanted to get some feedback about my ideas, which I realize might not happen by the deadline (24ish hours left), but even so I would appreciate it. I am trying to have a decent proposal by then, which might not be very concrete (more of a conceptual plan) and hoping to have several days after the melange deadline to develop it fully once I hear from you. I am not sure how the review process works, but I would appreciate some feedback from the mentors if you would be willing to consider a proposal modified after the official deadline, since I see there is a period of several weeks of review. That is so I know if I should slave away on it the days after the deadline, or if there's no point.

I am also trying to fix an issue and submit a pull request by the deadline, which is not going too well since I have started looking at SymPy only for the past several days. Fingers crossed though. Anyways I just uploaded a wiki page with my current general ideas (nothing specific yet, but I have one more day). Any feedback or references to discussions surrounding the topics I am looking at would be greatly appreciated. I have been digging through the doc files and the mailing list, but someone with experience might be able to point me to something I have not discovered yet.

Thank you in advance for any help. This looks like a great community and I look forward to talking with you more and hopefully contributing.

Peter Petrov  

Matthew Rocklin

unread,
Mar 20, 2014, 1:52:25 PM3/20/14
to sy...@googlegroups.com
Hi Peter,

You're definitely cutting it close.  The mailing list has more eyes on it and lower latency.  For rapid feedback I recommend dumping some of your project ideas here.  It's far more likely to generate conversation and enthusiasm.

Best,
-Matt


--
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+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
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/e3f6b945-a91e-41d2-bda9-548eaaae449c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Peter Petrov

unread,
Mar 20, 2014, 1:53:31 PM3/20/14
to sy...@googlegroups.com
Hi again,

I just posted the wiki page with my ideas. Took some time for my post to get moderated, so this is arriving extra late. At this stage it might be too late to get in a decent proposal in by the deadline, but I have been learning a lot digging through the code, so I'm gonna keep trying. 

Ondřej Čertík

unread,
Mar 20, 2014, 1:54:31 PM3/20/14
to sympy
Hi Peter,

On Thu, Mar 20, 2014 at 3:48 AM, Peter Petrov <petrov....@gmail.com> wrote:
> Hi everyone,
>
> I just found out about GSoC several days ago and it immediately struck me as
> being amazing. I have been trying to get involved in the open source
> community for a while now, but haven't been able to "find the time". I am
> currently in a PhD program working on theoretical physics (string theory),
> but have been doing quite a lot of tinkering with computer science in
> general lately and it has been really fascinating. GSoC seems like the exact
> type of thing to push me and keep me on track to start contributing
> seriously to open source projects and get my hands dirty with "real" coding.
> I immediately jumped on the SymPy page and started playing around with the
> packages. It's a little overwhelming how much is being developed
> simultaneously, but I am getting a feel for some of the interesting
> features.

Thanks for your interest! I am glad you like the work that's being done.

>
> I know it is a long shot to get approved for the GSoC, since I see most
> people have started working on proposals so early on, but I am still going
> to try and if it doesn't work I will at least have learned enough to start
> working on something interesting even without the funding (it would help
> though, since I will be able to devote more time to it over the summer).

It's never late to start! Definitely go for it.

>
> I wanted to get some feedback about my ideas, which I realize might not
> happen by the deadline (24ish hours left), but even so I would appreciate
> it. I am trying to have a decent proposal by then, which might not be very
> concrete (more of a conceptual plan) and hoping to have several days after
> the melange deadline to develop it fully once I hear from you. I am not sure
> how the review process works, but I would appreciate some feedback from the
> mentors if you would be willing to consider a proposal modified after the
> official deadline, since I see there is a period of several weeks of review.
> That is so I know if I should slave away on it the days after the deadline,
> or if there's no point.

The proposal in melange cannot be modified after the deadline, and
we'll be judging by what's in there.
However, I think you can comment in there during the review period
based on our questions,
so if we have any clarifying questions, we'll ask.

>
> I am also trying to fix an issue and submit a pull request by the deadline,
> which is not going too well since I have started looking at SymPy only for
> the past several days. Fingers crossed though. Anyways I just uploaded a

Do your best. Please ask if you have any questions.

> wiki page with my current general ideas (nothing specific yet, but I have
> one more day). Any feedback or references to discussions surrounding the
> topics I am looking at would be greatly appreciated. I have been digging

Here is the link:

https://github.com/sympy/sympy/wiki/GSoC-2014-Application-Peter-Petrov-High-Energy-Physics-Ideas

Let me read it.

> through the doc files and the mailing list, but someone with experience
> might be able to point me to something I have not discovered yet.
>
> Thank you in advance for any help. This looks like a great community and I
> look forward to talking with you more and hopefully contributing.

We are happy to see you around.

Ondrej

P.S. I never took a single CS class in my life either.

Ondřej Čertík

unread,
Mar 20, 2014, 2:17:13 PM3/20/14
to sympy
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.

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. Most of these things are in place, in some form.
In order to efficiently handle very large
expressions, I started developing CSymPy about half a year ago
(https://github.com/certik/csympy), this
will come very handy as well for these applications.

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. And let's be frank, it's currently the
best if you just care about getting the results. There is also GiNaC
(http://www.ginac.de/) that can be used for some of the
high energy stuff, but CSymPy can now do pretty similar things,
sometimes faster. So there is:

http://www.feyncalc.org/

there are all these various things people wrote for Mathematica:

@article{huber2012crasydse,
title={CrasyDSE: A framework for solving Dyson--Schwinger equations},
author={Huber, Markus Q and Mitter, Mario},
journal={Computer Physics Communications},
volume={183},
number={11},
pages={2441--2457},
year={2012},
publisher={Elsevier}
}

@article{huber2012algorithmic,
title={Algorithmic derivation of functional renormalization group
equations and Dyson--Schwinger equations},
author={Huber, Markus Q and Braun, Jens},
journal={Computer Physics Communications},
volume={183},
number={6},
pages={1290--1320},
year={2012},
publisher={Elsevier}
}

But the advantage of SymPy is that the whole stack is opensource, and
SymPy is just a library, so it better integrates
with things like IPython Notebook and you can create the whole
application in it. For example, the physics.quantum
module has some good stuff, that plays together much better than
packages in Mathematica. Another great application is PyDy.

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.
So there is plenty of things that could be done for the summer.

One of the things is for example just the Feynman diagrams generator
for various Lagrangians. 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. 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.

Another thing is of course Regularization and Renormalization.

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.

Ondrej

Ondřej Čertík

unread,
Mar 20, 2014, 2:25:15 PM3/20/14
to sympy
I.e. this would involve some classes for representation of Feynman diagrams,
that would also know how to nicely visualize themselves in the IPython Notebook,
and then code that generates them for various interactions.
And so on.

For other ideas, I have some derivations of various things here:

http://theoretical-physics.net/dev/src/quantum/qft.html#standard-model

that could be automated. For example one can reformulate the problem using
Green's functions and so on.

Ondrej

Matthew Rocklin

unread,
Mar 20, 2014, 2:34:24 PM3/20/14
to sy...@googlegroups.com
My thoughts on what's written so far are different from Ondrej's.  I am less excited by physics applications and more excited by the tools necessary to enable the expression of physics applications.  The extent to which a domain specific project like this can be broken into a generally applicable component (some mathy or algorithmic bit) and a domain specific application (some physics thing) is good.  This increases the applicability and relevance of a summer project to a wider audience.


--
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+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.

Stefan Krastanov

unread,
Mar 20, 2014, 3:29:12 PM3/20/14
to sy...@googlegroups.com
@Matthew, in general I would agree, but the algorithms for translating
"Lagrangian -> Feynman rules" or "Feynman rules + initial and final
state -> differential cross section" are already both 1) non trivial
and 2) domain specific. Abstracting this away might not be worth it as
it is not really used anywhere else.

(but where it is used, it is used a lot. There is an entire standard
around it (UFO model files and Les Houches dump files as described in
the FeynRules and MadGraph projects))

Exception: It might be useful in calculating correlations of some
multivariate functions through series expansions. That might we worth
investigating somewhat more.
> https://groups.google.com/d/msgid/sympy/CAJ8oX-EyLMkyEpgbqdbEvx5X6Y4ar96W0r6EzfELmZF18J_7UA%40mail.gmail.com.

Ondřej Čertík

unread,
Mar 20, 2014, 3:34:15 PM3/20/14
to sympy
On Thu, Mar 20, 2014 at 1:29 PM, Stefan Krastanov
<stefan.k...@yale.edu> wrote:
> @Matthew, in general I would agree, but the algorithms for translating
> "Lagrangian -> Feynman rules" or "Feynman rules + initial and final
> state -> differential cross section" are already both 1) non trivial
> and 2) domain specific. Abstracting this away might not be worth it as
> it is not really used anywhere else.
>
> (but where it is used, it is used a lot. There is an entire standard
> around it (UFO model files and Les Houches dump files as described in
> the FeynRules and MadGraph projects))

Exactly.

It would be good to have this in sympy. This would stress various
symbolic features a lot, and I think it would also be used a lot.

>
> Exception: It might be useful in calculating correlations of some
> multivariate functions through series expansions. That might we worth
> investigating somewhat more.

Ondrej

Peter Petrov

unread,
Mar 20, 2014, 3:40:35 PM3/20/14
to sy...@googlegroups.com
Thanks for all the replies. This was so fast. You guys are great. I will look into the references pointed out by Ondřej and try to narrow down a concrete problem. What Matthew said is exactly my idea. Working on a physics related problem will keep me interested and motivated to keep going, but I will be thinking of implementing constructs in a general way to be used in other problems. I think I will either focus on something tensor related (Gamma matrices or some type of functionality which automatically manipulates indices in different group representations), or maybe go with the Feynman diagram suggestion of Ondřej. As Stefan pointed out The Feynman diagram visualization is not really generalizable, but is still very important for a big community. There might be some general topology constructs there as well. 

Right now I started working on an issue to try and fix before the deadline. I am looking at https://github.com/sympy/sympy/issues/7134. There have been no replies for some months. Should I just post my thought in that thread and see if anyone jumps in. I think I have an idea of a basic (probably not very good, but hopefully working) resolution. At this point I am just trying to have something to submit as a pull request, but I am a little stuck on some technical details. I know its a simple issue, but I have to start somewhere right. 

Thanks again for all the comments!

Joachim Durchholz

unread,
Mar 20, 2014, 5:00:29 PM3/20/14
to sy...@googlegroups.com
Am 20.03.2014 20:40, schrieb Peter Petrov:
> Working on a
> physics related problem will keep me interested and motivated to keep
> going, but I will be thinking of implementing constructs in a general way
> to be used in other problems.

Actually that's one of the best ways to produce something generally useful.

Working just on one concrete problem tends to produce code that takes
shortcuts that make it non-reusable across application domains.
Working on a general framework without actually using it tends to
produce code that's clean and reusable but is awkward to use.

That approach you're taking is one of the better ways to navigate
between the Scylla of overspecifity and the Charybdis of overgenerality.
+1!

Ondřej Čertík

unread,
Mar 20, 2014, 6:18:47 PM3/20/14
to sympy
On Thu, Mar 20, 2014 at 1:40 PM, Peter Petrov <petrov....@gmail.com> wrote:
> Thanks for all the replies. This was so fast. You guys are great. I will
> look into the references pointed out by Ondřej and try to narrow down a
> concrete problem. What Matthew said is exactly my idea. Working on a physics
> related problem will keep me interested and motivated to keep going, but I
> will be thinking of implementing constructs in a general way to be used in
> other problems. I think I will either focus on something tensor related
> (Gamma matrices or some type of functionality which automatically
> manipulates indices in different group representations), or maybe go with
> the Feynman diagram suggestion of Ondřej. As Stefan pointed out The Feynman
> diagram visualization is not really generalizable, but is still very
> important for a big community. There might be some general topology
> constructs there as well.
>
> Right now I started working on an issue to try and fix before the deadline.
> I am looking at https://github.com/sympy/sympy/issues/7134. There have been
> no replies for some months. Should I just post my thought in that thread and
> see if anyone jumps in. I think I have an idea of a basic (probably not very
> good, but hopefully working) resolution. At this point I am just trying to
> have something to submit as a pull request, but I am a little stuck on some
> technical details. I know its a simple issue, but I have to start somewhere
> right.

If you want to quickly start with something, pick some issue here:

https://github.com/sympy/sympy/issues?labels=Easy+to+Fix&milestone=&page=1&state=open

Ondrej
> https://groups.google.com/d/msgid/sympy/db799754-02a6-4e35-93a3-8bee543b8882%40googlegroups.com.

Matthew Rocklin

unread,
Mar 20, 2014, 7:06:17 PM3/20/14
to sy...@googlegroups.com
The proposal still needs quite a bit of work.  I suspect that that's the bigger deadline.  Do we accept PRs after the initial GSoC submission deadline?


Peter Petrov

unread,
Mar 20, 2014, 7:21:34 PM3/20/14
to sy...@googlegroups.com
I just did some very minor work on https://github.com/sympy/sympy/issues/7134. It's a very simple and ad hoc solution for just the simplest case, and I am about to PR. It might not be even close to the right approach, but at least I got my hands dirty and went through the process of submitting a PR. I will work on it more later and try and get something reasonable after some discussions and research, but I hope this would be enough for you to consider me. I am going to start working on my proposal now and hopefully get to an ok point. My plan is to then continue my developing my ideas and update the wiki page as I improve on my proposal.

I realize it is a really long shot to get the funding, but the last 40 hours have been so much fun, that I will definitely try and work in the community as much as I can. I want to get hands on experience with coding and this looks like the perfect place for me to start, given that I can actually apply my knowledge of physics and learn a lot about computer science at the same time. 

Thanks for all the help. 

Aaron Meurer

unread,
Mar 20, 2014, 8:07:44 PM3/20/14
to sy...@googlegroups.com
Just push the PR. The PR submission deadline is tomorrow. It can be
merged after that (the deadline for that is the same as the date
Google announces who is selected).

Matthew is right, you should focus on your application, as Google is
very hard on that deadline.

Aaron Meurer
> https://groups.google.com/d/msgid/sympy/8a2c72f5-d071-46c0-a8c8-77db5af7fa30%40googlegroups.com.

Aaron Meurer

unread,
Mar 20, 2014, 8:08:52 PM3/20/14
to sy...@googlegroups.com
And by the way, I'm not just telling you to make the PR now because of
the deadline. In general, once you have code that does something, you
should push it up and open a pull request, so that the discussion on
your work can begin.

Aaron Meurer
Message has been deleted

Anurag Sharma

unread,
Mar 20, 2014, 8:25:53 PM3/20/14
to sy...@googlegroups.com


>I realize it is a really long shot to get the funding, but the last 40 hours have been so much fun, that I will definitely try and work in the community as much as I can. I want to get hands on experience >with coding and this looks like the perfect place for me to start, given that I can actually apply my knowledge of physics and learn a lot about computer science at the same time. 

Thanks for all the help. 


 Hi Peter
Do apply. Its a great community and each of us can benefit from other's expertise. :)
On a personal note it feels like we are all together to help you meet the deadline which in itself is a great feeling :)

Best of luck
Anurag

Peter Petrov

unread,
Mar 20, 2014, 8:35:05 PM3/20/14
to sy...@googlegroups.com
Yeah you guys have been awesome. Did not expect nearly as much attention and feedback. Just finished my PR, took longer than expected, but it was the first time I did anything like this.

Will go work on the proposal now.

Ondřej Čertík

unread,
Mar 20, 2014, 11:58:10 PM3/20/14
to sympy
On Thu, Mar 20, 2014 at 6:35 PM, Peter Petrov <petrov....@gmail.com> wrote:
> Yeah you guys have been awesome. Did not expect nearly as much attention and
> feedback. Just finished my PR, took longer than expected, but it was the
> first time I did anything like this.
>
> Will go work on the proposal now.

Since you only have this little PR, you should push some other code
that you wrote on your github (https://github.com/pppetrov) so that we
can see how you code and reference it from the application.

Ondrej

>
>
> On Thursday, March 20, 2014 8:25:53 PM UTC-4, Anurag Sharma wrote:
>>
>>
>>>
>>> >I realize it is a really long shot to get the funding, but the last 40
>>> > hours have been so much fun, that I will definitely try and work in the
>>> > community as much as I can. I want to get hands on experience >with coding
>>> > and this looks like the perfect place for me to start, given that I can
>>> > actually apply my knowledge of physics and learn a lot about computer
>>> > science at the same time.
>>>
>>> Thanks for all the help.
>>>
>>>
>> Hi Peter
>> Do apply. Its a great community and each of us can benefit from other's
>> expertise. :)
>> On a personal note it feels like we are all together to help you meet the
>> deadline which in itself is a great feeling :)
>>
>> Best of luck
>> Anurag
>
> --
> 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+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> 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/226aa601-4ad4-43eb-ba96-ef44bfd20a45%40googlegroups.com.

Aaron Meurer

unread,
Mar 21, 2014, 12:24:04 AM3/21/14
to sy...@googlegroups.com
Time management-wise, I would try to write the application now, until
the deadline, and work on the pull request this weekend.

Aaron Meurer
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CADDwiVDLDX6o1HPnCYyWJkO7AW_B7Fg4VTh5iZ0XY-q0SN%2BC4A%40mail.gmail.com.

Peter Petrov

unread,
Mar 21, 2014, 12:27:12 AM3/21/14
to sy...@googlegroups.com
The problem is I really do not have a lot of code written. I could fish out my old assignments from my intro CS course (in Java) several years back, which would probably not be very good, since I have learned quite a lot since then. Would you say not very good code is better than no code? I just started doing a course on Coursera and did the first assignment, which deals with an interesting problem of Percolation. Nothing fancy in terms of coding, and it was also in Java, but it might be the best I have. I had this idea to rewrite it in Python and expand its API to deal with a more general case I was wondering about. I guess I would just push it on github and work on it. It will probably be a work in progress though when you look at it. 

I really appreciate all the help you gave me. Quick question if you have the time. I am working on my proposal right now. I think I will propose to implement similar functionality as parts of FeynCalc, but ultimately focusing on building it on top of (as in using) current SymPy modules, like tensor, named groups, gamma matrices, maybe some algebraic geometry. Any such project would probably end up expanding, or fixing a lot of small things across multiple modules and then using those to build a new module to deal with field theories. I feel though for the three months available over the summer, it will likely have minimal functionality, since most of the time would be spend on tweaking different parts of the current code to fit my needs. 

I think this would be really useful, since it will (hopefully) provide a solid base to expand the "field theory" module after that. My concern is that it might sound like I will not accomplish anything substantial by the end of the summer, making it a bad project review-wise. 

Any thoughts?

Peter Petrov

unread,
Mar 21, 2014, 12:29:27 AM3/21/14
to sy...@googlegroups.com
Yep this is my plan. Proposal till the deadline and then look at the PR. I will also try have some decent code up on github by the end of the weekend hopefully

Aaron Meurer

unread,
Mar 21, 2014, 12:32:30 AM3/21/14
to sy...@googlegroups.com
On Thu, Mar 20, 2014 at 11:27 PM, Peter Petrov <petrov....@gmail.com> wrote:
> The problem is I really do not have a lot of code written. I could fish out
> my old assignments from my intro CS course (in Java) several years back,
> which would probably not be very good, since I have learned quite a lot
> since then. Would you say not very good code is better than no code? I just
> started doing a course on Coursera and did the first assignment, which deals
> with an interesting problem of Percolation. Nothing fancy in terms of
> coding, and it was also in Java, but it might be the best I have. I had this
> idea to rewrite it in Python and expand its API to deal with a more general
> case I was wondering about. I guess I would just push it on github and work
> on it. It will probably be a work in progress though when you look at it.

No, don't waste your time with bad code. If you want to write more
code, just submit more code to SymPy!

You can fix more bugs, or the pull request you started now has enough
potential that you can do a lot with it.

>
> I really appreciate all the help you gave me. Quick question if you have the
> time. I am working on my proposal right now. I think I will propose to
> implement similar functionality as parts of FeynCalc, but ultimately
> focusing on building it on top of (as in using) current SymPy modules, like
> tensor, named groups, gamma matrices, maybe some algebraic geometry. Any
> such project would probably end up expanding, or fixing a lot of small
> things across multiple modules and then using those to build a new module to
> deal with field theories. I feel though for the three months available over
> the summer, it will likely have minimal functionality, since most of the
> time would be spend on tweaking different parts of the current code to fit
> my needs.
>
> I think this would be really useful, since it will (hopefully) provide a
> solid base to expand the "field theory" module after that. My concern is
> that it might sound like I will not accomplish anything substantial by the
> end of the summer, making it a bad project review-wise.
>
> Any thoughts?

Don't worry. We tend to have a better idea of the "extra" work that
students will have to do to complete their projects than students do
(which is one reason why everyone tends to underestimate their
timelines).

Just outline the whole project, as you see it, so that we can see that
you have a good idea of what needs to be done from beginning to end.

Aaron Meurer
> https://groups.google.com/d/msgid/sympy/bcf182b3-ba79-4fca-bba3-c5cf5d7044f1%40googlegroups.com.

Ondřej Čertík

unread,
Mar 21, 2014, 1:24:50 AM3/21/14
to sympy
On Thu, Mar 20, 2014 at 10:32 PM, Aaron Meurer <asme...@gmail.com> wrote:
> On Thu, Mar 20, 2014 at 11:27 PM, Peter Petrov <petrov....@gmail.com> wrote:
>> The problem is I really do not have a lot of code written. I could fish out
>> my old assignments from my intro CS course (in Java) several years back,
>> which would probably not be very good, since I have learned quite a lot
>> since then. Would you say not very good code is better than no code? I just
>> started doing a course on Coursera and did the first assignment, which deals
>> with an interesting problem of Percolation. Nothing fancy in terms of
>> coding, and it was also in Java, but it might be the best I have. I had this
>> idea to rewrite it in Python and expand its API to deal with a more general
>> case I was wondering about. I guess I would just push it on github and work
>> on it. It will probably be a work in progress though when you look at it.
>
> No, don't waste your time with bad code. If you want to write more
> code, just submit more code to SymPy!
>
> You can fix more bugs, or the pull request you started now has enough
> potential that you can do a lot with it.

Exactly. Don't worry about your old code then. Send us more code to SymPy.
We want to see how your code, so that we can judge if you can finish the project
you propose.

>
>>
>> I really appreciate all the help you gave me. Quick question if you have the
>> time. I am working on my proposal right now. I think I will propose to
>> implement similar functionality as parts of FeynCalc, but ultimately
>> focusing on building it on top of (as in using) current SymPy modules, like
>> tensor, named groups, gamma matrices, maybe some algebraic geometry. Any
>> such project would probably end up expanding, or fixing a lot of small
>> things across multiple modules and then using those to build a new module to
>> deal with field theories. I feel though for the three months available over
>> the summer, it will likely have minimal functionality, since most of the
>> time would be spend on tweaking different parts of the current code to fit
>> my needs.
>>
>> I think this would be really useful, since it will (hopefully) provide a
>> solid base to expand the "field theory" module after that. My concern is
>> that it might sound like I will not accomplish anything substantial by the
>> end of the summer, making it a bad project review-wise.
>>
>> Any thoughts?
>
> Don't worry. We tend to have a better idea of the "extra" work that
> students will have to do to complete their projects than students do
> (which is one reason why everyone tends to underestimate their
> timelines).
>
> Just outline the whole project, as you see it, so that we can see that
> you have a good idea of what needs to be done from beginning to end.

Yes. In your proposal however, you should specify a clear set of deliverables.

Ondrej
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6LDk02R6xbUsF8ovyFSdYgaf7TzBOkRifhy4LaFB_ySOA%40mail.gmail.com.

mario

unread,
Mar 21, 2014, 5:29:46 AM3/21/14
to sy...@googlegroups.com

Here is an idea for a simple deliverable on the topics you mention:
maybe it might interest you:
computation of group invariants (Casimir, etc.) using tensors and
Feynman graphs; there is a book by Cvitanovic "Group theory" on this.
I have a closed PR https://github.com/sympy/sympy/pull/1699 on this,
see group_factors.py and tests, in which I compute the 4 loop graph in
Cvitanovic eq.(1.1).
I did only the U(N) case, I did not write Feynman rules, so there
is a lot on work on this; one can consider also zero dimensional field
theories with 'fields' belonging to some representation.

Well, it is not really simple, but it is much simpler than doing the same in d=4 field theory,
it is a useful toy model for that.

Ondřej Čertík

unread,
Mar 21, 2014, 10:42:13 AM3/21/14
to sympy
On Fri, Mar 21, 2014 at 3:29 AM, mario <mario....@gmail.com> wrote:
>
> Here is an idea for a simple deliverable on the topics you mention:
> maybe it might interest you:
> computation of group invariants (Casimir, etc.) using tensors and
> Feynman graphs; there is a book by Cvitanovic "Group theory" on this.
> I have a closed PR https://github.com/sympy/sympy/pull/1699 on this,

Yes. Peter, I forgot to mention that Mario Pernici is another person
you want to follow,
since he has done tons of work in this area with SymPy.

Ondrej
> --
> 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+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> 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/f0eca522-e0b7-4072-93d1-a0723b5271df%40googlegroups.com.

F. B.

unread,
Mar 21, 2014, 10:45:23 AM3/21/14
to sy...@googlegroups.com


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.

 

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!

Ondřej Čertík

unread,
Mar 21, 2014, 11:12:31 AM3/21/14
to sympy
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
> --
> 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+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> 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.

Matthew Rocklin

unread,
Mar 21, 2014, 11:35:08 AM3/21/14
to sy...@googlegroups.com
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.  


Alan Bromborsky

unread,
Mar 21, 2014, 11:43:46 AM3/21/14
to sy...@googlegroups.com

Attached is the LaTeX documentation for the latest rewrite of the
geometric algebra module (it will be submitted as soon as I finish the
new python-sphinx documentation) You might want to look in the
documentation for your applications, especially new treatment of
manifolds. As before the algebra of the Dirac matrices is simply the
geometric (Clifford) algebra of the basis vectors for 4-d Minkowski
space. Note that the section (both documentation and code) on tensors
as multi-linear multi-vector functions is a work in progress. Note that
the examples contain the geometric algebra formulation of the Dirac
equation. The major deficiency is that the fundamental theorem of
geometric calculus (contains generalized Stokes theorem, but is more
general) has not been implemented (no integral relations have been
implemented, but all derivatives have been). Note that rotations and
spinors are simply coded as the exponential forms of bivectors.
GA.pdf

Ondřej Čertík

unread,
Mar 21, 2014, 12:22:14 PM3/21/14
to sympy
Peter,

You need to submit your application *now* to Melange, otherwise it
can't be considered.

Ondrej
> --
> 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+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> 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/e3f6b945-a91e-41d2-bda9-548eaaae449c%40googlegroups.com.

Peter Petrov

unread,
Mar 21, 2014, 1:27:18 PM3/21/14
to sy...@googlegroups.com
Hey everyone,

I wanted to thank all of your for the immense help. I barely got the proposal in on time (30 mins to spare). Did not stand a chance without your help. 

I am actually kind of happy with the ideas I put together, especially given when I started. Hopefully you will like some of them them too. 

My presentation might be a little chaotic, but I think I at least put my ideas on there. 

I have been working on this for the past 40 hours straight so time for some well earned sleep.


I will put it on the official repo when I wake up.

Thanks again for everything

Looking forward to working with you on SymPy. 

I would really like to hear what you think when you get a chance to look at it, because regardless of the google thing I am excited to try and see if it is doable. 

Ondřej Čertík

unread,
Mar 21, 2014, 1:56:07 PM3/21/14
to sympy
Hi Peter,
Thanks for your work. I can see it there now.

I think you submitted a PR, but you should submit more over the
weekend so that we can see your coding skills.

Enjoy your sleep. ;)

Ondrej

F. B.

unread,
Mar 22, 2014, 9:23:29 AM3/22/14
to sy...@googlegroups.com

On Friday, March 21, 2014 4:35:08 PM UTC+1, Matthew wrote:
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.

Actually, tensors have an even more complicated multiplicative symmetry support:


That is, there are arbitrary groups with their own mutual commutation properties.

In any case, have a look at how Tracer.m works:


The function tr[ ] to calculate the trace is overloaded many times. It implies a pattern dispatch on the structure of its arguments, which is then efficiently handled by Mathematica. I call this pattern dispatch, which is a generalization of multiple dispatch involving pattern matching.

My implementation of Kahane's algorithm is not clear at all, the logic is unreadable without comments:

I implemented it using standard procedural programming, as Python is meant to. I believe that the logic of QFT should be implemented through pattern matching, it is much easier. The same is true for Quantum Mechanics.

Pattern matching would not work that well on sympy.tensor.tensor objects, because they have a complicated inner structure. That is, the tensor structure also stores index symmetry information about its indices. So, a tensor A(i, j) does not have i and j indices in its args, rather a complicated tree with much information. I believe that this problem could be addressed by storing symmetry info in a separate data structure, maybe resembling the new assumptions system.

I am already considering a similar approach to store components data outside of the tensor objects, by a dictionary lookup. See https://github.com/sympy/sympy/pull/2805

(by the way, components data on sympy.tensor.tensor was an idea I had to allow also for tensor-components based computations, alongside with the abstract tensor notation).

If we can make sure that tensor symmetry information can be stored outside of their args tree, then pattern matching on tensors could become much easier.

By the way, it is not about efficient pattern matching, it's just the args structure of the current tensors which is a mess to match against.

I can try to perform such rewrite on the tensor module, and it would also be nice to have the ability to define pattern dispatched functions (a generalization of multiple dispatch). This would endow Peter Petrov with a powerful tool to implement QFT.

@Matthew Rocklin: would you try to generalize your multiple dispatch module to pattern dispatch?

F. B.

unread,
Mar 22, 2014, 10:03:26 AM3/22/14
to sy...@googlegroups.com
Please also take care of this bug:


DiracSpinorIndex is the index for the Dirac matrices, its dimension is fixed to 4, it is a TensorIndexType, i.e. the class used to generate the actual indices to be placed into tensor expressions. The Lorentz index instead is contained inside a container class, which stores many Lorentz index type objects, based on their dimension.

The problem is that the gamma matrix dimension should be given by the spinor index dimension, not by the Lorentz index dimension, which should always be 4. Originally gamma matrices were meant to be tensors with a single index, so the trick was to put their dimension into the Lorentz index. Afterwards I decided to switch to a (Lorentz, Spinor, Spinor) type tensor, in order to avoid dealing with the complications of having a tensor of matrices. Unfortunately the dimensional marked remained on the Lorentz index.

Possible solutions:
  1. get rid of the _LorentzContainer class and replace it with a global LorentzIndex object.
  2. devise a better way to store the GammaMatrix dimension information.
Unfortunately this is not a very easy task.

Matthew Rocklin

unread,
Mar 22, 2014, 10:26:36 AM3/22/14
to sy...@googlegroups.com
@Matthew Rocklin: would you try to generalize your multiple dispatch module to pattern dispatch?

The multipledispatch package will only be about dispatch against types.  This package is intended for general programming and so efficiently covers the common case.  

However a long time ago though I was on a pattern matching and logic programming kick.  There are old/derelict unify and strategies modules in SymPy as a result. Most development was eventually transferred to the LogPy project, an implementation of miniKanren.  Among other things it held a basic unification/reification system, a dispatch system for those functions, and a less basic though still inefficient associative-commutative unification/reification system.  

In a SymPy branch I built up LogPy/SymPy integration and played with a simplification system that defined itself based on (source-pattern, target-pattern, boolean condition patterns) a la

Abs(x) -> x if x is positive

It worked fine but was slow in the case of associative-commutative operators.  I'll throw up some links below.  I suggest that if we want to continue this conversation we do it on a separate issue.

https://github.com/logpy/logpy  --  a logic programming system based on miniKanren

The trick behind efficient pattern matching in our case is to match an input expression against all of the patterns at once.  The patterns should be stored in a data structure like a Trie.  This is relatively straightforward in the non-associative-commutative case but a mess in the associative-commutative case.

Separating out matching from SymPy was nice.  I was also targeting Theano simplifications at the same time.


--
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+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.

F. B.

unread,
Mar 22, 2014, 3:55:05 PM3/22/14
to sy...@googlegroups.com


On Saturday, March 22, 2014 3:26:36 PM UTC+1, Matthew wrote:
@Matthew Rocklin: would you try to generalize your multiple dispatch module to pattern dispatch?

The multipledispatch package will only be about dispatch against types.  This package is intended for general programming and so efficiently covers the common case.  

However a long time ago though I was on a pattern matching and logic programming kick.  There are old/derelict unify and strategies modules in SymPy as a result. Most development was eventually transferred to the LogPy project, an implementation of miniKanren.  Among other things it held a basic unification/reification system, a dispatch system for those functions, and a less basic though still inefficient associative-commutative unification/reification system.  

In a SymPy branch I built up LogPy/SymPy integration and played with a simplification system that defined itself based on (source-pattern, target-pattern, boolean condition patterns) a la

Abs(x) -> x if x is positive

It worked fine but was slow in the case of associative-commutative operators.  I'll throw up some links below.  I suggest that if we want to continue this conversation we do it on a separate issue.

For what I mean, pattern dispatch can be very helpful for this issue. I mean, I added the algorithm to simplify gamma matrices, and my conclusion is that tensor manipulations should be performed by a pattern matching/pattern dispatching system. It would be a mess to implement every single tensor-manipulation rule by hand with for- or while-loops.

Pattern matching efficiency is not important here, we just need an easy way to translate physics laws to SymPy. An API to perform pattern matching/pattern dispatch is what is really required here, even if it has non-optimized algorithms behind it, efficiency can be later improved. Tensors are complicated data structures, and modern physics has an enormous amount of possible operations on all of their parts (tensors themselves, their indices, their symmetry group).

I once saw a post claiming that pattern matching would also be helpful to the quantum module, and in fact I guess that having to write many lines of code to implement simple physics transformation laws can be frustrating.


The trick behind efficient pattern matching in our case is to match an input expression against all of the patterns at once.  The patterns should be stored in a data structure like a Trie.  This is relatively straightforward in the non-associative-commutative case but a mess in the associative-commutative case.


The symmetry structure of tensors and tensor indices is more complicated. But maybe can avoid using these specificities with the pattern matcher.

I suggest that if Petrov gets accepted to the GSoC, we setup a pattern dispatcher to allow him to implement the tensor manipulation rules more easily during this summer. Please give me some feedback about this idea, I'm no expert in pattern matching algorithms and am unlikely to work on it if I'm alone.

Matthew Rocklin

unread,
Mar 22, 2014, 6:56:36 PM3/22/14
to sy...@googlegroups.com

Can you provide simple yet comprehensive examples of the sort of matching and transformations that you'd like to support?

--
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+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
Reply all
Reply to author
Forward
0 new messages