Page d'accueil du laboratoire > Équipe de Probabilités > Page principale > MetaPost
Propaganda, Exemples [1, 2, 3, 4, 5, 6, 7] m3Dplain, Statsmac, Animations, Transparence,

Petite propagande pour MetaPost :
quelques exemples (2)

Previous samples are quite old now, but this doesn't mean that I'm no longer programming simple figures with MetaPost as one may see below.

Paul Broussous and I had some discussions on mathematical graphics and tools for designing them. Once, he showed me how to have a visual perception of p-adic fields Qp (where p is some prime number): it may be represented thru some graphical representation of P1(Qp) which is this field compactified by a point at infinity, itself being the boundary of some infinite tree. A very simple metapost program ( could have done the job while hand drawing was not totally convincing.

P1(Q2) P1(Q3) P1(Q5) P1(Q7) P1(Q11)

Pol Vanhaecke needed to draw some Dynkin diagrams for a forecoming book. Since I attempted to design such diagrams by the past, I told him that I would have fun making these. The main resulting program is which is only an input file. Arrows, breadths, radii and spreads are intended to fit 10 points' Computer Modern. A sample file is (see also where one can remark that the syntax is not so far from, it is just richer.

vanhaeck1 vanhaeck2 vanhaeck3
vanhaeck4 vanhaeck5 vanhaeck6
vanhaeck7 vanhaeck8 vanhaeck9
vanhaeck10 vanhaeck11 vanhaeck12
vanhaeck13 vanhaeck14  

Drawing functions or parametrical curves in MetaPost is easy since many things are on the college level. What is more interesting is drawing implicit curves, i.e., curves defined by an equation like

(x, y) in R2      such that      f(x, y)=c,

where f is a quite regular map from R2 into R. Strangely, numerical methods for solving such problems are never described anywhere. When I was a young student, I spent hours in finding some technics, and, once found, hours in making them into practice. Recently, Paul Broussous and I discussed of this kind of problems, so I felt like showing him some numerical solutions with MetaPost. The equation is

(x, y) in R2      such that      x3 + y3 - 3xy =0

whose solutions form an elliptic curve. The program is and has been written late in a monday evening. Clicking on the image (which represents equipotential curves associated to the polynomial on the left-hand side of the equation) one would get a text written in french for an academic purpose.

x^3 + y^3 - 3xy = c

Stéphane Laurent works on some, step by step, finitely generated filtrations. This involves trees and examples, or counter-examples, are obtained with words valued processes. Designing trees by hands is a hard task. Doing it with MetaPost is quite easy and leads to high quality drawing as one can see (I hope) below. The program has not reached its final state but it is yet, I think, ready for designing many such trees.

split words

Paul Broussous seems to share with me some kind of love for mathematical pictures (I hope we are not the only ones). Every time he attempts to draw a picture with some mathematical software I won't name (I know nothing about northern America trees), I try to do the same with my own tools (MetaPost of course). The last case is the following:


This picture has been created quite rapidly with my m3Dplain format:



vardef blankdotlabel@#(expr t,loc) =
  save lab_; picture lab_;
  unfill bbox lab_;

  path p;
  def Fill(expr c, p, n) = 
    if Orientation(c) >= 0:
      addto currentpicture doublepath c
      withpen rule.nib withcolor PenColor
  pickup rule.nib;
  drawarrow proj(unit,0,0)..proj(4unit,0,0);
  label.lft(btex $x$ etex,proj(4unit,0,0));
  drawarrow proj(0,unit,0)..proj(0,4unit,0); $y$ etex,proj(0,4unit,0));
  drawarrow proj(0,0,unit)..proj(0,0,4unit); $z$ etex,proj(0,0,4unit));
  dotlabel.lft(btex $A$ etex, proj(unit,0,0));
  dotlabel.rt(btex $B$ etex, proj(-unit,0,0));
  dotlabel.urt(btex $N$ etex, proj(0,0,unit)); $S$ etex, proj(0,0,-unit));

Here is a much better version.


Pol Vanhaecke asked me if I was able to draw some graph on a torus. The problem is the following: in the plane, try to join 5 points with curves, each point being linked directly to every other point. What happens is that at least one curve intersects another one. This means that it is impossible to embed a complete graph with 5 edges in the plane. What is funny is that it is possible to do so in the torus as shown below. This picture has been made with the m3D programs, also it was one of the first time I attempted to draw curves on manifolds with them. Jian Qin asked me I still had the MetaPost code, and since the answser was maybe no, here some new one.

embedding of a complete 5 edges graph into the torus

Copyright: HTML's texts or graphics are free of any copyright, they are copyleft. TeX programs are also copyleft but one can send a postcard. MetaPost programs have just a feel-free-to-send-me-a-postcard licence. MetaFont programs have the standard LaTeX licence.
Valid HTML 4.01!
Anthony Phan,
Département de Mathématiques, SP2MI,
Boulevard Marie et Pierre Curie, Téléport 2,
BP 30179, F-86962 Futuroscope-Chasseneuil cedex