<TeXmacs|1.0.7.11>

<style|tmdoc>

<\body>
  <tmdoc-title|Example <name|Asymptote> sessions>

  <\session|asymptote|default>
    <\output>
      This is a TeXmacs interface for Asymptote.
    </output>

    <\unfolded-io|Asymptote] >
      size(0,3cm);draw(unitsquare);label("$A$",(0,0),SW);
    <|unfolded-io>
      <image|<tuple|<#[encoded data, 66072 characters]>|ps>||||>
    </unfolded-io>

    <\input|Asymptote] >
      \;
    </input>
  </session>

  And this one uses the new-style session interface, hit Ctrl-* to switch
  between code and rendering:

  <\script-output|asymptote|default>
    size(0,3cm);

    draw(unitsquare);

    label("$A$",(0,0),SW);

    label("$B$",(1,0),SE);

    label("$C$",(1,1),NE);

    label("$D$",(0,1),NW);
  </script-output|<image|<tuple|<#[encoded data, 70444 characters]>|ps>||||>>

  And asymptote can do much more complex things (requires 1.0.5.10 or later)
  <emdash> this is the \S<nbsp>centroidfg<nbsp>\T example from the gallery:

  <\script-output|asymptote|default>
    import graph;

    size(0,150);

    \;

    int a=-1, b=1;

    \;

    real f(real x) {return x^3-x+2;}

    real g(real x) {return x^2;}

    \;

    draw(graph(f,a,b,operator ..),red);

    draw(graph(g,a,b,operator ..),blue);

    \ 

    xaxis();\ 

    \;

    int n=5;

    \;

    real width=(b-a)/(real) n;

    for(int i=0; i \<less\>= n; ++i) {

    \ \ real x=a+width*i;

    \ \ draw((x,g(x))--(x,f(x)));

    }

    \ 

    labelx("$a$",a);

    labelx("$b$",b);

    draw((a,0)--(a,g(a)),dotted);

    draw((b,0)--(b,g(b)),dotted);

    \;

    real m=a+0.73*(b-a);

    arrow("$f(x)$",(m,f(m)),N,red);

    arrow("$g(x)$",(m,g(m)),E,0.8cm,blue);

    \;

    int j=2;

    real xi=b-j*width;

    real xp=xi+width;

    real xm=0.5*(xi+xp);

    pair dot=(xm,0.5*(f(xm)+g(xm)));

    dot(dot,darkgreen+4.0);

    arrow("$\\left(x,\\frac{f(x)+g(x)}{2}\M\\right)$",dot,NE,2cm,darkgreen);

    \;
  </script-output|<image|<tuple|<#[encoded data, 90448 characters]>|ps>||||>>

  <tmdoc-copyright|2011|Yann Dirson|Emmanuël Corcelle|Joris van der Hoeven>

  <tmdoc-license|Permission is granted to copy, distribute and/or modify this
  document under the terms of the GNU Free Documentation License, Version 1.1
  or any later version published by the Free Software Foundation; with no
  Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
  Texts. A copy of the license is included in the section entitled "GNU Free
  Documentation License".>
</body>

<\initial>
  <\collection>
    <associate|language|french>
    <associate|par-hyphen|normal>
  </collection>
</initial>