Feeds:
Posts

## Installing SAGE from the source on Debian.

I’m installing SAGE1 v.5.12 on my laptop which runs Debian. Here I describe the procedure.

1. Since there is no Debian binary package, you should download the source code. Here the link.
2. When it finishes, open a terminal C-M-t (sorry for the emacs notation, it means Ctrl+Alt+t)
• Go to the Downloads folder (or the right place where the tar file was saved)
$cd ~/Downloads • Untar the file $ tar xvf sage-5.12.tar
• Move to the sage-5.12 folder just created
cd sage-5.12/
3. Install the dependencies of the first line. Optionally install LaTeX and ImageMagick using the second line. (NOTE: superuser power is needed to run the below code)
$sudo apt-get install -y gcc perl m4 dpkg-dev$ sudo apt-get install -y texlive imagemagick
4. In machines with more than one core, the instruction to perform parallel compilation is (yo should change the “4” by the amount of cores in your machine)
$export MAKE="make -j4" 5. Now is time to compile the code.For a local compilation, run make For a You can relax, go and have a coffee, because the compilation may longs one hour (or more depending of the machine specifications). 6. For running the software after the installation is complete, run (on the SAGE directory) the command $ ./sage
• I don’t like to move to the SAGE directory every time and then run the ./sage command, therefore, I tend to create an alias on my ~/.bash_aliases file,
$echo "alias sage="sh ~/Downloads/sage-5.12/sage" >> ~/.bash_aliases This command adds the line alias sage="sh ~/Downloads/sage-5.12/sage at the end of the file ~/.bash_aliases, you can do it by hand with your favourite editor (gedit, emacs, nano, vim, …) • If you refresh your terminal (or open a new one) you just have to run the command sage to start SAGE. Additionally, the notebook environment can be started directly from the terminal by using the flag -n, $ sage -n

Hope you find this post useful! Remember to leave your comments or suggestions.

Enjoy!

## Footnotes:

1SAGE is an open source mathematical software which allows numerical and symbolic manipulations

After installing CalcHEP (see this post), oen should go to the working directory created by CalcHEP and running the program,

 $cd ~/Documents/WorkCalcHEP$ ./calchep

Calling the program.

Then the CalcHEP shell will appear, and you can choose your model (in future posts I’ll tell you the easiest way to create and import models)

List of Models included in CalcHEP

Once you have picked a model, you can enter a process

Possibilities after choosing the model

The list of particles in the model you have chosen is shown, and you can write the process you want to study. Note that diagrams with certain particles can be excluded, but in this example I didn’t.

Entering the process on the shell

Resulting in,

Result of the entered (sub)process

CalcHEP can draw the Feynman diagrams of a certain (sub)process,

Feynman diagrams of the subprocess

and after squaring the amplitude,

Squaring the (sub)process amplitude

you can see the “squared Feynman diagrams” 🙂 Cool, Isn’t it?

Squared Feynman diagrams of the (sub)process

In a future post I shall write about the numerical integration, or the possibility of exporting plots and Feynman diagrams to LaTeX 😀

Cheers.

## SAGE tip: More about Differential Forms

In a previous post we discuss the definition of the coordinated patch on a manifold, how to define differential forms, wedge them or calculate their exterior derivative… even simplify’em.

This time a zero form will be defined and a list of forms will be created… So, let’s begin!

# Define a 0-form

Once created the coordinated patch and the differential forms algebra

sage: reset()
sage: var('t,x,y,z')
sage: U = CoordinatePatch((t,x,y,z))
sage: Omega = DifferentialForms(U)

A 0-form is defined as an element of $\Omega^0(U)$, but the value of the 0-form is given inside the declaration command,

sage: A = DifferentialForm(Omega, 0, exp(x*y))

I tried addition, multiplication, wedge product and exterior differentiation on 0-forms and they worked!

Of course you can combine them with forms of different degrees.

# New method of defining a form

I wrote to Joris this morning… but before he was able to answer, from the documentation of the differential form package.

When one calls the generators of the differential form,

sage: Omega.gen(1)
dx

and the result is a differential form… Thus, one can assign a form as follow,

sage: A = sin(x)* Omega.gen(2)
sage: B = cos(y) * Omega.gen(0)
sage: C = sin(z) *Omega.gen(1)
sage: D = cos(y) * Omega.gen(2)

And this forms can be wedged, differentiated, et cetera. 🙂

# List of forms

Finally, after discovering the above behavior I tried the following, a list of differential forms ;-), for example,

sage: pro = matrix([[A, B], [C, D]])
sage: for i in range(2):
...       for j in range(2):
...           show(pro[i,j].diff())

returns
$cos(x)dx\wedge dz$
$sin(y)dx\wedge dy$
$-cos(z)dy\wedge dz$
$-sin(y)dy\wedge dz$

This implies that somehow one can manage a series of forms by using list properties… I expect to go deeper on this subject in the future! 😀

Enjoy people!!!

Dox

## SAGE tip: Working with Differential Forms.

A few weeks ago I realize there is a package for working with differential forms in SAGE. So, I’ve tried to take advantage of that!

This is what I’ve learnt so far.

If you work with differential forms you should know (probably better than me), that you define forms in a coordinate patch… rarely globally.

sage: reset()
sage: # The variables
sage: var('theta,phi,r')
sage: var("bps", latex_name=r"\bar{\psi}")
sage: var("bph", latex_name=r"\bar{\phi}")
sage: var("bth", latex_name=r"\bar{\theta}")
sage: # The coordinate system
sage: coords = [r,theta, phi, bps, bth, bph]
sage: U = CoordinatePatch((r,theta, phi, bps, bth, bph))
sage: Omega = DifferentialForms(U)

From a previous post a weird declaration of variables has been made.

But don’t lose yourself into the code!!!… the important here is:

• Seven variables have been declared,
• These are converted into a list,
• and also are the coordinated of the Coordinate Patch.
• Finally, $\Omega$ is the algebra of differential forms. Just like $\Omega^\bullet(M)$, where $M$ is the manifold (in this case the patch).
• ## Define the differential forms

Differential form have to be defined… like this,

sage: A = DifferentialForm(Omega, 1)
sage: A[1] = -1/4
sage: A[2] = 1/4*(-cos(theta) - sin(theta))
sage: A[3] = cos(bps)*sin(bth)*sin(bph)
sage: A[4] = sin(bps)*cos(bth)*sin(bph)
sage: A[5] = sin(bps)*sin(bth)*cos(bph)

The first line defines $A$ as an element of $\Omega^1(M)$.

The rest of the lines are for setting the components of $A$. Remember that the coordinates run from 0 to 6 in this example! 😛 And, of course, they are ordered strictly as we declared them, i.e.,

$A = -\frac{1}{4}d\theta -\frac{1}{4}(\cos(\theta) + \sin(\theta))d\phi + \cos(\bar{\psi})\sin(\bar{\theta})\sin(\bar{\phi})d\bar{\psi} +\cdots$

## Exterior Differentiation

Once the form has been declared, one might differentiate it by using the diff command,

sage: A.diff()

returns

$(\frac{1}{4} \, \sin\left(\theta\right) - \frac{1}{4} \, \cos\left(\theta\right)) d \theta \wedge d \phi$

## Showing the forms

It’s very useful to see the formulas in a nice written way… this is one of the features I love the more from SAGE, to see your form, use

 sage: show(A)

## Wedge Product

Of course one of the most important operations when working with forms is the wedge product. For using this, try

sage: C = A.wedge(A.diff())
sage: show(C)

it vanishes. One might try to define another form,

sage: B = DifferentialForm(Omega,2)
sage: B[0,1] = sin(bth)

Note that $B\in \Omega^2(M)$, and has only one non-vanishing component.

Thus, $A\wedge B$ is calculated,

sage: A.wedge(B)

One can also define multiple wedge product,

sage: A.wedge(B.diff()).wedge(B)

Needless to say one can multiply a form by a function, or number.

## Simplifying a form

Forms have not implemented the simplify_full attribute, but their components, which are functions, do. So, after a very complicated calculation one might try to implement a long routine of simplification, say,

sage: D = A.wedge(B.diff()).wedge(B)
for i in xrange(Omega.ngens()):
for j in xrange(i+1, Omega.ngens()):
for k in xrange(j+1, Omega.ngens()):
for l in xrange(k+1, Omega.ngens()):
for m in xrange(l+1, Omega.ngens()):
D[i,j,k,l,m] = D[i,j,k,l,m].simplify_full()


In the above, Omega.ngens() returns the dimension of the patch. Additionally, each index runs from the value of the previous plus one, in order to avoid repetition (due to anti-symmetric property) or the zeros values.