Difference between revisions of "AoPSWiki:Sandbox"

Line 1: Line 1:
<span style="font-size: 250%; color:#27445C">'''To the point Tutorial for Using Asymptote in AoPS'''</span>
+
<span style="font-size: 200%; color: #27445C">'''Essential Reference for Using Asymptote in AoPS'''</span>
 +
 
 +
A focused asymptote reference with examples and short code
 
----
 
----
== The Name Asymptote ==
+
==Introduction==
<div class="mw-collapsible mw-collapsed" style="width:100%">
+
<br><dd>
<big>'''The Name Asymptote'''</big>
+
=== Why Asymptote is called Asymptote? ===
<div class="mw-collapsible-content">
+
 
* Why Asymptote is called Asymptote?
 
 
<blockquote>http://asymptote.sourceforge.net/FAQ/section1.html#whyasy
 
<blockquote>http://asymptote.sourceforge.net/FAQ/section1.html#whyasy
Question 1.4. Why was the name Asymptote chosen?
+
<b>Question 1.4. Why was the name Asymptote chosen?</b>
Well, it isn't the  perfect graphics package, but we do think it is getting there  asymptotically...
+
 
 +
<i>Well, it isn't the  perfect graphics package, but we do think it is getting there  asymptotically...</i>
 
</blockquote>
 
</blockquote>
</div></div>
 
=== The Very Basics ===
 
 
LaTeX uses a special "math mode" to display mathematics. There are two types of this "math mode":
 
 
==== In-line Math Mode ====
 
 
In in-line math mode, we use <code>$</code> signs to enclose the math we want to display, and it displays in-line with our text. For example, typing <code>$\sqrt{x} = 5$</code> gives us <math>\sqrt{x} = 5.</math>
 
 
==== Display Math Mode ====
 
 
In display math mode, we enclose our code in double dollar signs, and it displays the math centered and on its own line. For example, <code>$$\sqrt{x} = 5$$</code> gives us <cmath>\sqrt{x} = 5.</cmath>
 
 
==== In-line vs. Display ====
 
 
Besides displaying in-line vs. displaying centered and on a new line, the two modes render differently in other ways. Note that <code>$\sum_{k=1}^n k^2$</code> gives us <math>\textstyle\sum_{k=1}^n k^2,</math> whereas <code>$$\sum_{k=1}^n k^2$$</code> gives us <cmath>\sum_{k=1}^n k^2.</cmath>
 
 
=== Basic Expressions ===
 
 
==== Multiplication ====
 
 
Sometimes, when we're multiplying, we don't need a multiplication symbol. For instance, we can write <math>xy</math> instead of <math>x\cdot y</math> without ambiguity. However, when you're multiplying numbers, for instance, a multiplication symbol comes in handy. The standard symbol is given by <code>$\cdot$</code>. For example, <code>$12\cdot\frac{1}{2}$</code> gives us <math>\textstyle 12\cdot \frac 12.</math>
 
  
==== Fractions ====
+
=== Tips ===
 
 
We can make fractions via <code>$\frac{...}{...}$</code>. For instance, <code>$\frac{x+y}{2}$</code> will give us <math>\textstyle\frac{x+y}{2}.</math>
 
 
 
 
 
<h1>Asymptote tutorial for AoPS</h1>
 
<dd>
 
== The Name Asymptote ==
 
<div class="mw-collapsible mw-collapsed" style="width:100%">
 
<big>'''The Name Asymptote'''</big>
 
<div class="mw-collapsible-content">
 
* Why Asymptote is called Asymptote?
 
<blockquote>http://asymptote.sourceforge.net/FAQ/section1.html#whyasy
 
Question 1.4. Why was the name Asymptote chosen?
 
Well, it isn't the  perfect graphics package, but we do think it is getting there  asymptotically...
 
</blockquote>
 
</div></div>
 
  
<div class="mw-collapsible mw-collapsed" style="width:100%">
 
<big>'''Tips'''</big>
 
<div class="mw-collapsible-content">
 
 
* To see the asymptote code of any diagram made with asymptote, click on the diagram and it will come up.
 
* To see the asymptote code of any diagram made with asymptote, click on the diagram and it will come up.
 
* If your code is not working check to make sure you have a semicolon after each line, no extra parentheses or brackets, and no open parentheses or brackets.
 
* If your code is not working check to make sure you have a semicolon after each line, no extra parentheses or brackets, and no open parentheses or brackets.
 
* Another thing to check if your code is not working, is to make sure every variable you've used in your code is in the pair.
 
* Another thing to check if your code is not working, is to make sure every variable you've used in your code is in the pair.
<br></div></div>
+
</dd><br>
  
<div class="mw-collapsible mw-collapsed" style="width:100%">
+
== Beginning your code ==
'''#1 Beginning your code'''
+
<dd>
<div class="mw-collapsible-content">
 
<br>
 
 
To start your asymptote diagram you have to include [asy] at the beginning, and [/asy] at the ending.
 
To start your asymptote diagram you have to include [asy] at the beginning, and [/asy] at the ending.
<br></div></div>
+
</dd><br>
  
<div class="mw-collapsible mw-collapsed">
+
== Setting points ==
'''#2 Setting points'''
+
<dd>
<div class="mw-collapsible-content">
 
<br>
 
 
To create points in your diagram you can use
 
To create points in your diagram you can use
 
   <code>A = (0,0);</code>
 
   <code>A = (0,0);</code>
Line 77: Line 34:
  
 
Note: You should not use E, S, N, or W as variables, instead you should use EE, SS, NN, and WW, but label them as E, S, N, W. This is because E, S, N, and W are used to indicate directions in asymptote.
 
Note: You should not use E, S, N, or W as variables, instead you should use EE, SS, NN, and WW, but label them as E, S, N, W. This is because E, S, N, and W are used to indicate directions in asymptote.
<br></div></div>
+
</dd><br>
 +
 
 +
== Pair part 1 ==
 +
<dd>
 +
<asy>
 +
draw((0,0)--(3,7),red);
 +
dot((0,0));
 +
dot((3,7));
 +
label("Produced with Asymptote "+version.VERSION,point(S),2S);
 +
</asy>
 +
<nowiki>[asy]..[/asy]</nowiki>
 +
<tt><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></tt>
  
<div class="mw-collapsible mw-collapsed" style="width:100%">
 
'''#3 Pair part 1'''
 
<div class="mw-collapsible-content">
 
<br>
 
 
If you include variables in your diagram you have to have <math>\verb#pair#</math> somewhere in your code.
 
If you include variables in your diagram you have to have <math>\verb#pair#</math> somewhere in your code.
  
 
Example: You have two points <math>A</math> and <math>B</math>, and you're drawing a line connecting them, you need to include
 
Example: You have two points <math>A</math> and <math>B</math>, and you're drawing a line connecting them, you need to include
  pair A,B;
+
<code> pair A,B; </code>
 
in your diagram to make it work.
 
in your diagram to make it work.
<br></div></div>
+
</dd><br>
  
 
<div class="mw-collapsible mw-collapsed" style="width:100%">
 
<div class="mw-collapsible mw-collapsed" style="width:100%">
Line 96: Line 65:
 
Once you have set variables <math>A</math> and <math>B</math>, you can connect them by writing
 
Once you have set variables <math>A</math> and <math>B</math>, you can connect them by writing
  
<code>draw(A--B);</code>
+
  <codeblock>draw(A--B);</codeblock>
  
 
Example:
 
Example:
Line 1,210: Line 1,179:
 
<br></div></div>
 
<br></div></div>
 
</dd>
 
</dd>
 
[[Category:Asymptote tutorial for AoPS]]
 

Revision as of 18:12, 3 June 2022

Essential Reference for Using Asymptote in AoPS

A focused asymptote reference with examples and short code


Introduction


Why Asymptote is called Asymptote?

http://asymptote.sourceforge.net/FAQ/section1.html#whyasy

Question 1.4. Why was the name Asymptote chosen?

Well, it isn't the perfect graphics package, but we do think it is getting there asymptotically...

Tips

  • To see the asymptote code of any diagram made with asymptote, click on the diagram and it will come up.
  • If your code is not working check to make sure you have a semicolon after each line, no extra parentheses or brackets, and no open parentheses or brackets.
  • Another thing to check if your code is not working, is to make sure every variable you've used in your code is in the pair.


Beginning your code

To start your asymptote diagram you have to include [asy] at the beginning, and [/asy] at the ending.


Setting points

To create points in your diagram you can use

 A = (0,0);

Say you want to have point $B$ $4$ units to the right of point $A$, then you can use

 B = (4,0);

Setting points on your diagram is like setting points on a graph. The first number is the $x$-coordinate of the point and the second number is the $y$-coordinate of the point.

Note: You should not use E, S, N, or W as variables, instead you should use EE, SS, NN, and WW, but label them as E, S, N, W. This is because E, S, N, and W are used to indicate directions in asymptote.


Pair part 1

[asy] draw((0,0)--(3,7),red); dot((0,0)); dot((3,7)); label("Produced with Asymptote "+version.VERSION,point(S),2S); [/asy] [asy]..[/asy] [asy] draw((0,0)--(3,7),red); dot((0,0)); dot((3,7)); label("Produced with Asymptote "+version.VERSION,point(S),2S); [/asy]

If you include variables in your diagram you have to have $\verb#pair#$ somewhere in your code.

Example: You have two points $A$ and $B$, and you're drawing a line connecting them, you need to include pair A,B; in your diagram to make it work.


Expand

#4 Connecting two points, coloring the line

Expand

#5 Labeling, Midpoint

Expand

#6 Angle Measures

Expand

#7 Distance Function

Expand

#8 Casting

Expand

#9 Right Angle Mark

Expand

#10 Intersection

Expand

#11 Filling

Expand

#12 Dot

Expand

#13 Size

Expand

#14 Tick Marks

Expand

#15 Arrows

Expand

#16 Shifting Coordinates

Expand

#17 Rotating

Expand

#18 Circles

Expand

#19 Dashed Lines

Expand

#20 Angle Mark

Expand

#21 "for" Command

Expand

#22 Extension

Expand

#23 How to draw an equilateral triangle

Expand

#24 How to draw an isosceles triangle

Expand

#25 How to draw a scalene triangle

Expand

#26 Labeling Angles

Expand

#27 Drawing triangles using SSS, SAS, AAS, and ASA

Expand

#28 Arcs

Expand

#29 The Nine Point Circle

Expand

#30 Pair Part 2

Expand

#31 Finding the midpoint

Expand

#32 Foot Command

Expand

#33 Introduction to 3D Geometry