Mon préambule latex
04 juillet 2012 | Catégories: latex | View CommentsVoici le préambule latex que j'utilise souvent:
\documentclass[12pt]{article} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{latexsym} \usepackage{graphicx} \usepackage{amssymb} \usepackage{amsthm} \usepackage[margin=2cm]{geometry} \usepackage{url} \usepackage{color} \usepackage{enumerate} \usepackage[shortlabels]{enumitem} %pour commencer les enumerations a des nombres differents \usepackage[small]{caption} \usepackage{cite}
Pour des fichiers en français, j'utilise les packages suivants:
\usepackage[T1]{fontenc} % Hyphénation des mots accentués \usepackage{lmodern} % Polices vectorielles \usepackage[french]{babel} % Vocabulaire en francais \usepackage[utf8]{inputenc} % Codage UNICODE (UTF-8)
My implementation of André's Joyal Bijection using Sage
12 mai 2012 | Catégories: sage | View CommentsDoron Zeilbeger made a talk last Friday at CRM in Montreal during Sage Days 38 about \(n^{n-2}\). At the end of the talk, he propoed a contest to code Joyal's Bijection which relates double rooted trees on \(n\) vertices and endofunctions on \(n\) elements. I wrote an implementation in Sage. My code is available here : joyal_bijection.sage. It will certainly not win for the most brief code, but it is object oriented, documented, reusable, testable and allows introspection.
Example
First, we must load the file:
sage: load joyal_bijection.sage
Creation of an endofunction:
sage: L = [7, 0, 6, 1, 4, 7, 2, 1, 5] sage: f = Endofunction(L) sage: f Endofunction: [0..8] -> [7, 0, 6, 1, 4, 7, 2, 1, 5]
Creation of a double rooted tree:
sage: L = [(0,6),(2,1),(3,1),(4,2),(5,7),(6,4),(7,0),(8,5)] sage: D = DoubleRootedTree(L, 1, 7) sage: D Double rooted tree: Edges: [(0, 6), (2, 1), (3, 1), (4, 2), (5, 7), (6, 4), (7, 0), (8, 5)] RootA: 1 RootB: 7
From the endofunction f, we get a double rooted tree:
sage: f.to_double_rooted_tree() Double rooted tree: Edges: [(0, 6), (2, 1), (3, 1), (4, 2), (5, 7), (6, 4), (7, 0), (8, 5)] RootA: 1 RootB: 7
From the double rooted tree D, we get an endofunction:
sage: D.to_endofunction() Endofunction: [0..8] -> [7, 0, 6, 1, 4, 7, 2, 1, 5]
In fact, we get D from f and vice versa:
sage: D == f.to_double_rooted_tree() True sage: f == D.to_endofunction() True
Timing
On my machine, it takes 2.23 seconds to transform a random endofunction on \(\{0, 1, \cdots, 9999\}\) to a double rooted tree and then back to the endofunction and make sure the result is OK:
sage: E = Endofunctions(10000) sage: f = E.random_element() sage: time f == f.to_double_rooted_tree().to_endofunction() True Time: CPU 2.23 s, Wall: 2.24 s
Comments
I am using the Sage graph library (Networkx) to find the cycles of a graph and to find the shortest path between two vertices. It would be interesting to compare the timing when using the zen library which is lot faster then networkx.
Testing the IPython 0.12 Notebook
08 mai 2012 | Catégories: sage | View CommentsOn December 21 2011, version 0.12 of IPython was released with its own notebook. The differences with the Sage Notebook are explained by Fernando Perez, leader of IPython project, in the blog post The IPython notebook: a historical retrospective he wrote last January. One of the differences is that the IPython Notebook run in its own directory whereas each cell of the Sage Notebook lives in its directory.
The latest version of IPython is 0.12.1 and was released in April 2012 and I was curious of testing it. I followed the installations informations. I got into trouble some times but finally managed to install it. Below is how I did to install IPython 0.12.1 on my OSX 10.5.8 using Python 2.6.7.
Installing dependencies:
sudo easy_install-2.6 tornado sudo easy_install-2.6 nose sudo easy_install-2.6 pyzmq
The following command was broken for a while:
sudo easy_install-2.6 pyzmq
ending with error TypeError: 'NoneType' object is not callable. I managed to make it work by redoing the above install commands in the correct above order:
sudo easy_install-2.6 tornado sudo easy_install-2.6 nose sudo easy_install-2.6 pyzmq
Installing ipython-0.12:
sudo easy_install-2.6 ipython
To make ipython known from the command line, I added the following line to the file ~/.bash_profile:
# ipython export PATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin:$PATH
I tested the ipython installation with the iptest command. It finishes with Status: OK
iptest
I open the ipython notebook and it worked:
ipython notebook [NotebookApp] Using existing profile dir: u'/Users/slabbe/.ipython/profile_default' [NotebookApp] The IPython Notebook is running at: http://127.0.0.1:8888 [NotebookApp] Use Control-C to stop this server and shut down all kernels.
In safari, I get the following problem:
Websocket connection to ws://127.0.0.1:8888/kernels/86fef706-f386-4116-b3e4-d6d7776afb0d could not be established. You will NOT be able to run code. Your browser may not be compatible with the websocket version in the server, or if the url does not look right, there could be an error in the server's configuration.
But, in firefox, it works when I open a page at the above adress http://127.0.0.1:8888. It gives me the following dashboard page.

I created my first notebook and did some tests. I followed the documentation found here.

The next thing would be to try to use this with Sage. Some progress has been done and can be followed at ticket #12719.
Notes d'une présentations de Ben Wiggins
06 mai 2012 | Catégories: ultimate | View CommentsEn fin de semaine, les équipes de compétitions de Montréal (MUCC) et l'Association d'ultimate de Montréal (AUM) ont invité Ben Wiggins, longtemps entraîneur de l'équipe Sockeye de Seattle, à donner des ateliers pratiques et théoriques sur l'ultimate.
Comme j'étais occupé avec ma soutenance de thèse, j'ai pu assister à seulement un atelier que j'ai bien aimé. Voici les notes que j'ai prises.
Evolution of the overall doctest coverage of Sage up to 4.8
01 mai 2012 | Catégories: sage | View CommentsRecently, a discussion on sage-devel mentionned the graph I did last year for the evolution of the overall doctest coverage of Sage. The graph was out of date, so I updated it with the recent data:
Sage 4.7: May 26, 2011 85.4% ~ 23769 / 27833 Sage 4.7.1: August 16, 2011 85.7% ~ 24129 / 28155 Sage 4.7.2: November 03, 2011 86.0% ~ 24477 / 28462 Sage 4.8: January 20, 2012 86.1% ~ 24601 / 28573
We are far from the +4.7% a year I was expecting...
Doctest coverage of Sage

I think we should now stop looking at this percentage for the 100% coverage goal, because the coverage is mostly influenced by the hundreds of new doctested functions that are added to every new version of Sage.
Instead we should consider the evolution of the number of undoctested functions (and maybe fix objectives about it):
Sage 4.7: May 26, 2011 4064 Sage 4.7.1: August 16, 2011 4026 -> 38 old functions now 100% doctested Sage 4.7.2: November 03, 2011 3985 -> 41 old functions now 100% doctested Sage 4.8: January 20, 2012 3972 -> 13 old functions now 100% doctested
Here is the graph of it:
Number of undoctested functions in Sage

« Previous Page -- Next Page »