I just returned from the 10th International Mathematica Symposium held in Beijing China, where I gave a talk. It was a great opportunity to see the work of other people around the world and the new features of Mathematica 8.
Some of the topics included medical imaging, stochastic simulations, video editing, real-time control, automatic C code generation, CUDA and more.
Friday, July 30, 2010
Wednesday, July 7, 2010
Quantum entanglement and classical chaos
I recently attended a talk about the connection between quantum entanglement and classical chaos
http://www.nature.com/nature/journal/v461/n7265/full/nature08396.html
This tells me that the underlying reason of the sensitivity to initial conditions in classical mechanics may be the rise of entanglement in a sequence with the collapse of the wave function.
http://www.nature.com/nature/journal/v461/n7265/full/nature08396.html
This tells me that the underlying reason of the sensitivity to initial conditions in classical mechanics may be the rise of entanglement in a sequence with the collapse of the wave function.
Monday, July 5, 2010
Venn diagrams in R

This is my first attempt to use R, the well known program for statistics.
I am using the package LIMMA and the instructions found here in order to draw Venn diagrams. My code is
-----------------------------------------
library(limma)
data1<-read.csv("/home/rcabrera/Documents/source/mathematica/Xiongmao/VennDiagram/H1h1.csv", sep=',', header=T)
data2<-read.csv("/home/rcabrera/Documents/source/mathematica/Xiongmao/VennDiagram/H1h2.csv", sep=',', header=T)
data3<-read.csv("/home/rcabrera/Documents/source/mathematica/Xiongmao/VennDiagram/H1h3.csv", sep=',', header=T)
set1<-data1$x
set2<-data2$x
set3<-data3$x
set123<-union(set1,union(set2,set3))
bool1 = logical(length(set123))
bool2 = logical(length(set123))
bool3 = logical(length(set123))
for(i in 1:length(set123)) bool1[i]<-is.element(set123[i],set1)
for(i in 1:length(set123)) bool2[i]<-is.element(set123[i],set2)
for(i in 1:length(set123)) bool3[i]<-is.element(set123[i],set3)
c3<-cbind(bool1, bool2, bool3)
a <- vennCounts(c3)
vennDiagram(a)
-----------------------------------------------
Note.- The data is stored in a column with label "x"
Friday, July 2, 2010
Mersenne Twister in CUDA
The Mersenne Twister algorithm (what a cool name) for generating random numbers is implemented as an example in the SDK folder provided by NVIDIA. However, as it happens with all the examples, it depends on the CUTIL library, which is not part of the standard CUDA API. There is another problem, the compilation of each example is carried out by a general set of makefiles customized for compiling all the examples. These are big problems if we want to generate a stand alone version of the examples. This is desirable because in this way we could adapt the code for our own purposes and eventually link with extra code.
In the rest of this post I will give the makefiles that accomplish the stand alone compilation independent of CUTIL for the Mersenne Twister example.
You will have to follow the following steps :
- Make a copy of the Mersenne Twister folder from the SDK (I renamed as MersenneTwisterCUDA),
- Remove all the references for the CUTIL library
- Add the following lines on MersenneTwister.cu
char raw_path[] = "/YOUR_PATH/MersenneTwisterCUDA/data/MersenneTwister.raw";
char dat_path[] = "/YOUR_PATH/MersenneTwisterCUDA/data/MersenneTwister.dat";
while removing the corresponding lines that originally define raw_path and dat_path.
- Finally, paste the make files I will provide and run $make on the command line
(Define YOUR_PATH according to the structure of your directories)
file: common
----------------------------------------------------------------
CUDA_PATH = /usr/local/cuda
C := gcc
CC := c++
NVCC := $(CUDA_PATH)/bin/nvcc
CUDA_INCLUDE_PATH = /usr/local/cuda/include
CUDA_LIB_PATH := $(CUDA_PATH)/lib64
CUDA_FLAGS = -lcuda -lcudart
===================================================
file: Makefile:
----------------------------------------------------------------------------
include ./common.mk
MersenneTwister.out: genmtrand.c.o MersenneTwister_gold.cpp.o MersenneTwister.cu.o
$(NVCC) -L$(CUDA_LIB_PATH) $(CUDA_FLAGS) genmtrand.c.o MersenneTwister_gold.cpp.o MersenneTwister.cu.o -o MersenneTwister.out
MersenneTwister.cu.o: MersenneTwister.cu dci.h MersenneTwister.h MersenneTwister_kernel.cu
$(NVCC) -c -I$(CUDA_INCLUDE_PATH) MersenneTwister.cu -o MersenneTwister.cu.o
MersenneTwister_gold.cpp.o: MersenneTwister_gold.cpp
$(CC) -c MersenneTwister_gold.cpp -o MersenneTwister_gold.cpp.o
genmtrand.c.o: genmtrand.c
$(C) -c genmtrand.c -o genmtrand.c.o
In the rest of this post I will give the makefiles that accomplish the stand alone compilation independent of CUTIL for the Mersenne Twister example.
You will have to follow the following steps :
- Make a copy of the Mersenne Twister folder from the SDK (I renamed as MersenneTwisterCUDA),
- Remove all the references for the CUTIL library
- Add the following lines on MersenneTwister.cu
char raw_path[] = "/YOUR_PATH/MersenneTwisterCUDA/data/MersenneTwister.raw";
char dat_path[] = "/YOUR_PATH/MersenneTwisterCUDA/data/MersenneTwister.dat";
while removing the corresponding lines that originally define raw_path and dat_path.
- Finally, paste the make files I will provide and run $make on the command line
(Define YOUR_PATH according to the structure of your directories)
file: common
----------------------------------------------------------------
CUDA_PATH = /usr/local/cuda
C := gcc
CC := c++
NVCC := $(CUDA_PATH)/bin/nvcc
CUDA_INCLUDE_PATH = /usr/local/cuda/include
CUDA_LIB_PATH := $(CUDA_PATH)/lib64
CUDA_FLAGS = -lcuda -lcudart
===================================================
file: Makefile:
----------------------------------------------------------------------------
include ./common.mk
MersenneTwister.out: genmtrand.c.o MersenneTwister_gold.cpp.o MersenneTwister.cu.o
$(NVCC) -L$(CUDA_LIB_PATH) $(CUDA_FLAGS) genmtrand.c.o MersenneTwister_gold.cpp.o MersenneTwister.cu.o -o MersenneTwister.out
MersenneTwister.cu.o: MersenneTwister.cu dci.h MersenneTwister.h MersenneTwister_kernel.cu
$(NVCC) -c -I$(CUDA_INCLUDE_PATH) MersenneTwister.cu -o MersenneTwister.cu.o
MersenneTwister_gold.cpp.o: MersenneTwister_gold.cpp
$(CC) -c MersenneTwister_gold.cpp -o MersenneTwister_gold.cpp.o
genmtrand.c.o: genmtrand.c
$(C) -c genmtrand.c -o genmtrand.c.o
Sunday, May 30, 2010
Classical Origin of Fermion Spin
The spin was postulated by Pauli from experimental evidence, but it was only with the arrival of the Dirac equation that the spin appears naturally. This leaded to many people to consider the spin as fundamentally "quantum". In the following paper we argue that the spin appears naturally from classical relativistic mechanics alone
W. E. Baylis, R Cabrera, J.D. Keselica, Quantum/Classical Interface: Classical Geometric Origin of Fermion Spin, Advances in Applied Clifford Algebras, 2010
W. E. Baylis, R Cabrera, J.D. Keselica, Quantum/Classical Interface: Classical Geometric Origin of Fermion Spin, Advances in Applied Clifford Algebras, 2010
Wednesday, May 12, 2010
Maxwell's demon
Mark G Raizen recently gave a talk about techniques for trapping and cooling atoms. In this way, he actually implemented Maxwell's demon in practice!
http://www.sciencemag.org/cgi/content/abstract/324/5933/1403
Yes, this demon exists and does not violate the second law of thermodynamics because information is a thermodynamic variable with an essential role.
http://www.sciencemag.org/cgi/content/abstract/324/5933/1403
Yes, this demon exists and does not violate the second law of thermodynamics because information is a thermodynamic variable with an essential role.
Wednesday, May 5, 2010
Attention span
The amount of information we can absorb not only depends on the time we actually engage our attention. It also depends on how we distribute this time in subintervals. It seems that we can only pay our highest degree of attention for a few seconds [wikipedia article], so what do we do in the rest?
Related to this topic is the strategy followed by Hollywood, who are interested in maintaining their movies as appealing as possible. In this next article there is an interesting analysis of the duration and distribution of the shoot lengths.
James E. Cutting, Attention and the Evolution of Hollywood Film Psychological Science, 2010
One of the main conclusions is that the distribution of power in the frequency domain must obey 1/f , where f is the frequency. I am sure this is particularly important for teachers and students.
More comments about this article can be found here.
Related to this topic is the strategy followed by Hollywood, who are interested in maintaining their movies as appealing as possible. In this next article there is an interesting analysis of the duration and distribution of the shoot lengths.
James E. Cutting, Attention and the Evolution of Hollywood Film Psychological Science, 2010
One of the main conclusions is that the distribution of power in the frequency domain must obey 1/f , where f is the frequency. I am sure this is particularly important for teachers and students.
More comments about this article can be found here.
Subscribe to:
Posts (Atom)