Feeds:
Posts
Comments

Posts Tagged ‘Calculation’


On a previous post I described how to change the LaTeX options of the Cadabra notebook.

I collaborate with a colleague, who uses the standard cadabra installation. Therefore, If I write a Cadabra notebook, he needs to pullback the personalised notebook to the standard one. The pullback script can be downloaded here!!!

Author: Oscar Castillo-Felisola

Created: 2014-02-18 Tue 20:20

Emacs 24.3.1 (Org mode 8.2.5h)

Validate

Advertisements

Read Full Post »


Just by playing around with CADABRA, I found out the existence of a super-useful LaTeX package, called breqn, which allows to break long equations at the edge of the page… like the wraping feature of most text editors.

However, when one manipulates really long expressions, I’d like to break these long equations through the page. I’m still looking for this feature… in that case I can improve even more the behaviour of cadabra‘s notebook, when compiling it to LaTeX.

Any suggestions???

Cheers!

Read Full Post »


Goal: a cadabra notebook more LaTeX friendly.

  1. I run a Debian system. Don’t know why, but the original source code in the git repo didn’t work!!!What did I do? I downloaded the code from the Debian repository.
    $ sudo apt-get build-dep cadabra # Install all dependences
    $ mkdir -p ~/Software # Create a folder to download the source
    $ cd ~/Software # Move to the folder
    $ apt-get source cadabra # Download the source code (from Debian)
  2. On the cadabra folder created through the last command line, I looked for the window.cc file and open it
    $ emacs cadabra-1.29/gui/window.cc &
  3. On the window.cc file I changed:
    • The LaTeX package color by the improved xcolor, by changing the string
      << "\\usepackage[usenames]{color}\n"

      by

      << "\\usepackage{xcolor}\n"
    • I added the LaTeX package listings, which improves the verbatim properties (among other things). Right after the mentioned xcolor line, I added the following
      << "\\usepackage{listings}\n"
      << "\\lstset{\n"
      << "  basicstyle=\\small\\color{blue}\\ttfamily,\n"
      << "  breaklines=true,\n"
      << "  columns=fullflexible,\n"
      << "  commentstyle=\\color{gray!60},\n"
      << "  morecomment=[l]{\\%\\%},\n}"

      This allows the Cadabra code to break at the end of the line instead of going out of the page, when compiled to LaTeX (similar to what breqn does on equations).

    • Now, I changed on the DataCell::c_input: case,1 the strings {\\color[named]{Blue}\\begin{verbatim}\n by \\begin{lstlisting}\n, and \n\\end{verbatim}}\n by \n\\end{lstlisting}\n.Far below, the lines with the code if(ln=="{\\color[named]{Blue}\\begin{verbatim}") { should be changed to if(ln=="\\begin{lstlisting}") {, as well as else if(ln=="\\end{verbatim}}") { should be changed to else if(ln=="\\end{lstlisting}") {.
    • Save all the changes
  4. Finally, time to compile
    $ ./configure
    $ make
    $ sudo make install
  5. If your compilation/installation went through, and you try to open an old cadabra notebook (a notebook created with the original cadabra code), the program will complain that the file is not compatible… but I created a small script to transform the old files into new files! Download it here!!USAGE:
    $ ./transf_cadabra oldfile.cnb newfile.cnb

Footnotes:

1This is located a few lines below the lines where the LaTeX preamble is defined

Author: Oscar Castillo-Felisola

Created: 2014-02-18 Tue 10:09

Emacs 24.3.1 (Org mode 8.2.5h)

Validate

Read Full Post »


Hello again! If you are looking for a Differential Geometry tool, a Sage package which is under development is SageManifold. Let’s see how to install it.

  1. Download the package using the link (currently v.0.2). I’d assume it is saved on your Downloads folder.
  2. Assuming you have SAGE installed, and you have created an alias to call it (see my previous post), run the following command
    $ sage -f ~/Downloads/manifolds-0.2.spkg
  3. To generate the documentation (in case you don’t want to or cannot download it), use either of the commands
    $ sage -docbuild sagemanifolds pdf
    $ sage -docbuild sagemanifolds html
  4. In order for using the package, start your WorkSheet with the command line
    from manifolds.all import *
Have a nice calculation!

Read Full Post »


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.

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

List of Models included in CalcHEP

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

Possibilities after choosing the model

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

Entering the process on the shell

Resulting in,

Result of the entered (sub)process

Result of the entered (sub)process

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

Feynman diagrams of the subprocess

Feynman diagrams of the subprocess

and after squaring the amplitude,

Squaring the (sub)process amplitude

Squaring the (sub)process amplitude

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

Squared Feynman diagrams of the (sub)process

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.

Read Full Post »


Last weekend, I wrote a program in SAGE that list all possible irreps of a Lie group, one specified the group (in Cartan’s classification) and the maximum sum of the Dynkin labels.

Check the notebook in here.

Since I’m not a programmer, please feel free to leave comments, specially if you find ways to optimize the program

Cheers,

DOX

Read Full Post »


Sage beginner’s guide is a book by  Craig Finch, published recently by PACKT publishing.

After spending two weeks looking at different aspects of the book, I can say with property that this is an excellent book, an I’ll recommend it for beginners to medium experienced SAGE users.

Since this is the first book I review, and also the first I own from this publisher, I’d say that its format is quite understandable, and one might learn a lot by following examples… and then, just then, the details are explained. I really love that feature of the writing.

The first chapter, called What can we do with Sage?, shows in about 20 pages some powerful tools available in Sage, from symbolic calculation, linear algebra, ODE’s, to plotting functions in 2D and 3D… even fitting of curves.  I’ll say this is an impressive chapter, and it’s just the start point. Nonetheless, as in any book, one might notice that in some examples the graphics do not correspond to the code, but when you try the code yourself, you get the right ones.

The chapter about Installing Sage, is written in detail, and explain how to install the software in the three major operative systems: Windows, X OS, and Linux. Of course, due to the unstoppable develop of open source software, there’s a delay in the version shown in the book, however, the steps to follow are the same. A nice thing is that it’s explained how to compile the source for multi-core systems.

Getting Started with Sage, shows a huge amount of small tricks, I mean… I’ve been using Sage for about one a half year, and had no idea of plenty of the tricks explained in this chapter. Awesome!!!

All aspects of Sage are exploited, command line, notebook, different cells in the notebook, all the different types of variables available… and their operations. Functions and even a quick introduction to object oriented programming.

Another useful chapter of the book is the one where some differences (and similarities) between Sage and Python are explained. As a example, the use of commands like range, xrange or srange.

Chapters 5 to 8 show with plenty examples and incredible detail uses of Sage in linear algebra, visualization (plotting), symbolic and numerical calculation. Of course, there is no way I can explain how vast the content is, but include:

  • Simplifications in symbolic calculation,
  • Manipulation and analysis of data,
  • Integral transforms,
  • Differential equations,
  • Series,
  • Differential and integral calculus,
  • Numerical calculus, et cetera.

Finally, the last two chapters are more a complement for intermediate users, specially with programming knowledge. They cover python programming, say functions, classes and modules, and its uses, and more advanced features of Sage as \LaTeX integration, optimization of numerical calculation (with NumPy and Cython), and an introduction to the interactive mode.

Thus, In a scale from zero to ten I’d give a 9/10 to this book, because managing such a variety of tricks and functions are worth it.

 

You can check out the book at http://www.packtpub.com/sage-beginners-guide/book

Read Full Post »

Older Posts »