Art of Problem Solving

Asymptote (Vector Graphics Language): Difference between revisions

Aldw123 (talk | contribs)
Curiousmonkey (talk | contribs)
Replaced content with "<asy> draw((0,0)--(3,7)); dot((0,0)); dot((3,7)); </asy>"
Tag: Replaced
Line 1: Line 1:
{{Asymptote}}
<asy>
 
draw((0,0)--(3,7));
'''Asymptote''' is a powerful vector graphics language designed for creating mathematical diagrams and figures.  It can output images in either eps or pdf format, and is compatible with the standard mathematics typesetting language, [[LaTeX]].  It is also a complete programming language, and has cleaner syntax than its predecessor, [http://netlib.bell-labs.com/who/hobby/MetaPost.html MetaPost], which was a language used only for two-dimensional graphics.
 
Here is an example of an image that can be produced using Asymptote:
 
<center>[[Image:Figure1.jpg]]</center>
 
In a sense, Asymptote is the ruler and compass of typesetting.
 
 
You can use Asymptote on the AoPSWiki right now, by enclosing the Asymptote code within <tt><nowiki><asy>...</asy></nowiki></tt> tags. For example, the following code
<pre><nowiki><asy>
draw((0,0)--(3,7),red);
dot((0,0));
dot((3,7));
label("Produced with Asymptote "+version.VERSION,point(S),2S);
</asy></nowiki></pre>
created the picture
<center><asy>
draw((0,0)--(3,7),red);
dot((0,0));
dot((0,0));
dot((3,7));
dot((3,7));
label("Produced with Asymptote "+version.VERSION,point(S),2S);
</asy>
</asy></center>
And on the AoPS forums you can use <tt><nowiki>[asy]..[/asy]</nowiki></tt>
 
Another example:
 
<pre><nowiki>[asy]
pair A,B,C,X,Y,Z;
A = (0,0);
B = (1,0);
C = (0.3,0.8);
draw(A--B--C--A);
X = (B+C)/2;
Y = (A+C)/2;
Z = (A+B)/2;
draw(A--X, red);
draw(B--Y,red);
draw(C--Z,red);
[/asy]</nowiki></pre>
 
<asy>
pair A,B,C,X,Y,Z;
A = (0,0);
B = (1,0);
C = (0.3,0.8);
draw(A--B--C--A);
X = (B+C)/2;
Y = (A+C)/2;
Z = (A+B)/2;
draw(A--X, red);
draw(B--Y,red);
draw(C--Z,red);</asy>

Revision as of 19:15, 18 September 2019

[asy] draw((0,0)--(3,7)); dot((0,0)); dot((3,7)); [/asy]