Sunday, April 29, 2007 is working

I finally got it working. :)

If you want to try it, go to the examples directory and:

ondra@syslik:~/sympy/examples$ python
Christoffel symbols:



Ricci tensor:
solve the Einstein's equations:
\lambda(r) = -log(C1+C2*r**(-1))
-(C1+C2*r**(-1)) 0 0 0
0 (C1+C2*r**(-1))**(-1) 0 0
0 0 r**2 0
0 0 0 r**2*sin(\theta)**2

It will start with a general, spherically symmetric metric:

(0, exp(lam(r)), 0, 0),
(0, 0, r**2, 0),
(0, 0, 0, r**2*sin(theta)**2)

notice the two unknown functions nu(r) and lam(r) and it calculates the Christoffel symbols, Riemann and Ricci tensors, then solves the differential (Einstein) equations for nu and lam and substitute it back to the metric to get the Schwarzschild metric (last matrix in the output from

If you look into the, you will see, that when solving the equations, I am a little cheating in that I am assuming

nu(r) == -lam(r)

that can be shown by playing with the equations. That is so that I get just one differential equation for just one unknown function and then I plug it into the dsolve() and I am done.

Tuesday, April 24, 2007

Some more ideas what I want SymPy to do

Today I found several Mathematica packages for doing things in general relativity and quantum field theory, I updated the links here. I found xTensor, SusyMath and cadabra (this one is written in C++). Many more can be found in the Computer Physics Communications journal (CPC). Those packages are opensource, but depend on a proprietary product. And I cannot help myself, but when I look at the sources, I just find the Mathematica language completely messy.

So now I am concentrating to get the working and then calculate something that they did. And if it turns out that it is reasonably fast (i.e. I will get the correct result in minutes, or hours) and if the source code is going to be short and nice (I hope so), I'll try to write an article about it to CPC. As a side effect, it will be a real world test for SymPy. Also I would like then to do the same calculation in SAGE, to see how it compares to SymPy. What I don't like in SAGE is that I prefer to import the library as a normal python module and I don't want to be trapped in another environment (SAGE is actually preproccessing the input a little, like converting ^ to ** etc, which I don't like at all). I think the symbolic package should be a regular standard python library. And who knows python, should easily understand how to work with that.

Right now I am struggling with the mattern matching (issue 82) in order for the dsolve() to be able to solve the differential equations that arise in
I would like to make it into 0.4. I think we can release a little after sympy gets into debian unstable (hopefuly in a week or two), so that we can check how it behaves etc. and fix everything for 0.4.

I know that there are still some issues, that are quite embarrassing they still don't work in SymPy, but I think more important is to "release early, release often".

Thursday, April 19, 2007

some future plans

If everything goes well, SymPy should be quite well tested when the summer is over and GSoC projects will improve it in the areas: geometry, graphing, concrete mathematics, linear algebra and polynomial equations (and stuff).

For me SymPy starts to be usable enough so that I can actually calculate something interesting. I started with the Schwarzschild solution to the Einstein's equations of the general relativity. So I start with a diagonal metric tensor, and calculate the Ricci tensor using SymPy and this works remarkably well and I get the correct differential equations. Now I am trying to make the SymPy's dsolve() to solve them. And then I would like to make pictures like this one using the graphing module. The code is in examples/

My other application is the Quantum Field Theory, where I am trying to calculate some simple cross sections, however, SymPy is pretty slow on that, but when we optimize the polynomials stuff, it should work just fine. The code is in examples/

Being able to use symbolic manipulation in the Python language allows me to be really productive. And also it's fun, because it's a pleasure, like any other programming in Python. Programming in Maple is not a pleasure for me at all.

So over the summer, I'll try to make SymPy calculate the above things because that will show, if SymPy is usable, or not. Besides that, I want to polish the web page, and documentation and installation especially. And get it to Debian and Ubuntu.

Is any of you using something else than Debian/Ubuntu/Windows? If so, would you be willing to create a package for your distribution? :)

Sunday, April 15, 2007


This blog will be used to coordinate the Google Summer of Code for the SymPy project.
I'm Ondrej Certik, the author of SymPy, and together with Fabian Seoane (who joined SymPy in February 2007), Jim Jewett and Mike Haertel we'll be mentoring 5 students: Robert, Mateusz, Brian, Chris and Jason.

Here is a picture of me in Prague:

and in Washington: