Thursday, December 8, 2011

De Broglie waves and relativity

Another extremely interesting connection between relativity and quantum mechanics is that the quantum De Broglie waves can be understood as an effect of the relativistic desynchronization of clocks given that the clocks rotate with a frequency proportional to the total energy of the particle.   

Imagine a train with a long chain of synchronized clocks from one extreme to the other with the synchronization established according to an observer moving along with the train. Another person standing still on the train station will conclude that the clocks are actually not synchronized (what he would see is a different thing). If the train is moving to the right, the clocks on the right will be ahead respect to the clocks on the left. The De Broglie wave length will be the length that stretches 12 hours of desynchronization.   

[1] W. Baylis, Canadian Journal of Physics, 2007, 85:(12) 1317-1323, 10.1139/p07-121

Tuesday, December 6, 2011

The ball is round!

The first thing we learn in a course of relativity is the relativistic length contraction effect for moving objects relative to an observer. However, what one would actually see is a different thing ! because another important effect must be considered; the time required for the light to arrive from the different points of the observed object to our eyes. The combined effect of the Lorentz contraction along with the time delay was investigated reaching to curious results. For example, a relativistic ball remains with a round appearance!, as discussed by Penrose in the following paper

http://adsabs.harvard.edu/abs/1959PCPS...55..137P

A nice visulaization can be found at

http://www.spacetimetravel.org/ueberblick/ueberblick1.html

Monday, November 7, 2011

Thermodynamical entropy and Shannon information

The moment I read about information theory I thought that it was evident that the thermodynamical entropy  was completely equivalent; the same thing, just measured in different units with the Boltzmann constant in the middle. I was shocked when I read that this issue is still under debate today. There are two books that share the idea that the thermodynamical entropy is fundamentally a measure of information
  • A Farewell To Entropy: Statistical Thermodynamics based on Information. By Arieh Ben-Naim
  • E.T. Jaynes: Papers on Probability, Statistics and Statistical Physics. By R.D. Rosenkrantz (Editor)
The main issue is that the Shannon information is fundamentally conserved, while  the thermodynamical entropy  may describe irreversible systems where it is not conserved. More about this topic can be found at



Tuesday, November 1, 2011

PyNewtonCUDA

Denys Bondar and I, just released to the public: PyNewtonCUDA

https://code.google.com/p/py-newton-cuda/

This program is able to propagate a large number of classical particles using  GPU technology. The code is written in Python and PyCUDA, which allows to write high-level code for GPU programming while maintaining very high performance.


You can download the code with the following command

svn checkout https://py-newton-cuda.google.com/svn/trunk PyNewtonCUDA

Friday, June 24, 2011

Classical Relativistic Many-Body Dynamics

I found a book on the interesting and very difficult topic of many-body classical relativistic theory

Classical Relativistic Many-Body Dynamics

Trump, M.A., Schieve, W.C
Springer, Fundamental Theories of Physics, Vol. 103

This relativistic covariant many-body formulation overcomes the no go theorem by Jordan and Sudarshan [1] by giving up the locality of the interactions and the individual mass-shell conditions. These are not simply cosmetic upgrades but have serious consequences on how we should understand classical physics.

"The single particle has no significance; it is the whole system that counts" --Lanczos


[1] FROM CLASSICAL TO
QUANTUM MECHANICS
Giampiero Esposito, Giuseppe Marmo

Friday, June 3, 2011

Geo-coordinates for citations on scientific papers

Here I draw a map for the places that either published a paper mentioning the word Bures measure or were referenced by somebody who used the word Bures measure

The corresponding plot with the citations as links was created by my brother Ruben Cabrera


The total number of papers in consideration were 662. The extraction of coordinates from heterogeneous references is an expensive computational task.

Thursday, May 19, 2011

Mathematica CDF documents

This is my first Mathematica cdf document on the Internet.
The most remarkable feature of a cdf document is that it can be posted on a web site and evaluated by anybody with a web browser and the freely available cdf player plugin.

Graph demo
Note.- Unfortunately, it only works on Windows and Mac.

Friday, May 13, 2011

Bibliographic Graphs Time-Line

Different colors for different publication dates. Dark green for the oldest to dark purple to the latest
  • Key word: Bures measue

  • Key word: Haar measure 

Tuesday, May 10, 2011

Bibliographic Graphs

Continuing with bibliographic graphs.
Here I combine the graphs from the Bures measure in green and the Haar measure in red, where the publications that are common in both are in orange

Sunday, May 8, 2011

Bibliographic Graphs

I just made a Mathematica program to generate the citation graph for scientific academic publications given a specific keyword (and some upper limit on the number of publications to treat). Some examples for three areas of my own interest are shown below
  • Key word: "Bures measure"
  • The same job done for  "Haar measure" 
It seems that the research done for the "Haar measure" is made of several unconnected niches. However, I expect that they will find some connection as I let the program run for more time.

  • One final example for "Quantum control"

Bibliographic research is now easier because I can put the mouse on the top of each node and see what paper is that. Something nice would be to output the whole bibtex file.

Acknowledgements: This program was made possible thanks to the help of my friend Josh Greig.

Sunday, May 1, 2011

Extracting data from a pdf file

There are a few quite expensive commercial programs for extracting data from pdf files, but a few lines of Mathematica code may be able to do the job for most cases. For example, the following file with  many pages
results in the following table
Note.- This method works for text-searchable pdf files. Otherwise, this would be an image processing job.

Thursday, April 21, 2011

Mathematica as a C code generator

Mathematica is able to generate C code ready to be compiled and ultimately capable to produce a stand alone executable file. Nice !. There are restrictions on the extent of what can be be processed in this way but it can be really useful in practice as it is right now.

The generation of the executable can be done within Mathematica or outside Mathematica. The Mathematica 8.0 help for my Linux Fedora 64bits requires a minor adjustment in order to work. For Linux systems:

"Libraries" -> "WolframRTL_Static_Minimal.lib"

must be replaced by

"Libraries" -> "WolframRTL_Static_Minimal"


(Thanks to Abdul Dakkak for helping on this)

How do we compile the generated code outside Mathematica? This issue is detailed next



  •  The Mathematica code that generates the C code for a simple example taken from the help is

code =
  CProgram[
   CInclude["stdio.h"],
   CInclude["compute.h"],
   CFunction["int", 
    "main", {{"int", "argc"}, {"char", 
      CDereference[CArray["arg", {}]]}},
    CBlock[{
      CDeclare["double", CAssign["num1", 20.4]],
      CDeclare["double", "num2"],
      CDeclare["WolframLibraryData", 
       CAssign["libData", 
        CCall["WolframLibraryData_new", {"WolframLibraryVersion"}]]],
      CCall["Initialize_compute", {"libData"}],
      CCall["compute", {"libData", "num1", CAddress["num2"]}],
      CCall["printf", {CString["%5.2f\n"], "num2"}],
      CCall["WolframLibraryData_free", {"libData"}],
      CReturn[0]}]]
   ];
cStr = ToCCodeString[code]

mainSource = Export[FileNameJoin[{outDir, "main.c"}], cStr, "Text"]

c = Compile[{{x}}, x^2];
CCodeGenerate[c, "compute", FileNameJoin[{outDir, "compute.c"}], 
  "CodeTarget" -> "WolframRTL"];
CCodeGenerate[c, "compute", FileNameJoin[{outDir, "compute.h"}], 
  "CodeTarget" -> "WolframRTLHeader"];

where
outDir
must be defined according the user's desires


  • The generated main.c file with a minor manual retouching in the printf function is


#include "compute.h"

#include "WolframRTL.h"


int main(int argc, char *arg[])
{
double num1 = 20.4;

double num2;
WolframLibraryData libData = WolframLibraryData_new(WolframLibraryVersion);
Initialize_compute(libData);

compute(libData, num1, &num2);
printf("%5.2f\n", num2);

WolframLibraryData_free(libData);
return 0;
}



  • The generated file compute.c is

#include "math.h"

#include "WolframRTL.h"

static WolframCompileLibrary_Functions funStructCompile;

static mbool initialize = 1;

#include "compute.h"

DLLEXPORT int Initialize_compute(WolframLibraryData libData)
{

if( initialize)
{
funStructCompile = libData->compileLibraryFunctions;
initialize = 0;
}

return 0;
}

DLLEXPORT void Uninitialize_compute(WolframLibraryData libData)
{
if( !initialize)
{

initialize = 1;
}
}

DLLEXPORT int compute(WolframLibraryData libData, mreal A1, mreal *Res)
{

mreal R0_0;
mreal R0_1;
R0_0 = A1;
R0_1 = R0_0 * R0_0;
*Res = R0_1;

funStructCompile->WolframLibraryData_cleanUp(libData, 1);
return 0;
}


  • The generated file compute .h is

#include "WolframLibrary.h"

EXTERN_C DLLEXPORT int Initialize_compute(WolframLibraryData libData);

EXTERN_C DLLEXPORT void Uninitialize_compute(WolframLibraryData libData);

EXTERN_C DLLEXPORT int compute(WolframLibraryData libData, mreal A1, mreal *Res);



  • Finally, the Makefile that takes care of the compilation is

CXX = /usr/bin/c++

MATHEMATICA_INCLUDE_PATH = /usr/local/Wolfram/Mathematica/8.0/SystemFiles/IncludeFiles/C

MATHEMATICA_LIB_PATH = /usr/local/Wolfram/Mathematica/8.0/SystemFiles/Libraries/Linux-x86-64


a.out: main.c compute.o
 ${CXX} -I${MATHEMATICA_INCLUDE_PATH} -L${MATHEMATICA_LIB_PATH} -lm -lWolframRTL -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -pthread compute.o main.c

compute.o: compute.c
 ${CXX} -c -I${MATHEMATICA_INCLUDE_PATH}  -L${MATHEMATICA_LIB_PATH}  compute.c 



Of course, make sure that the libraries are in the right place and eventually you will need to add the path of the Mathematica libraries in  ld.so.conf and apply /sbin/ldconfig





  • A more elaborated example taking a real matrix input and a real matrix output is here
  • A similar example implemented for complex matrices here

Wednesday, April 20, 2011

GDP per energy consumption

Here, the world map for the GDP per unit of energy consumption. The world map has so much variation of this index that I had to make a log plot
In the case of the American continent, the linear scale is better

Sunday, April 17, 2011

Energy consumption per capita

I pulled out some data from Wolfram Alpha to make the following world map of the energy consumption per capita

A close up of America is also interesting

Friday, April 8, 2011

Thursday, April 7, 2011

Energy consumption by country

This is my first widget from Wolfram Alpha



Wow!! so nice and simple to make

Tuesday, March 29, 2011

Finances and the rise of machines

Last Friday March 25th I attended the Princeton University Conference on Quant Trading.

One of the most interesting talks was the analysis of the role of computers in trading
Rise of the Machines: Algorithmic Trading in the Foreign Exchange Market

The conclusion is that computers are becoming more and more prevalent and actually dominate the Forex market already.

Friday, March 25, 2011

Inverse Matrix by the Exchange Method

After some time off, here I am again.

Here is an interesting implementation of the inverse of a matrix that I found useful when I was developing a CUDA program. This is the most efficient method to implement the inverse of a matrix in terms of memory usage, which is handy when we want to put everything in the fast but limited shared memory.

The Mathematica code is here

InverseExchange.cdf

The cuda code is next
InverseExchange.cu

Sunday, January 30, 2011

J. Math. Phys Most Downloaded Articles in August 2010

My paper about the connection between the Householder decomposition of unitary matrices and the canonical coset representation of unitary groups was the second most downloaded paper in August 2010

http://jmp.aip.org/features/most_downloaded?month=8&year=2010