diff options
Diffstat (limited to 'info/asy-overview/src/chapter3/chapter3.tex')
-rw-r--r-- | info/asy-overview/src/chapter3/chapter3.tex | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/info/asy-overview/src/chapter3/chapter3.tex b/info/asy-overview/src/chapter3/chapter3.tex index 162ef87df7..d592b69c22 100644 --- a/info/asy-overview/src/chapter3/chapter3.tex +++ b/info/asy-overview/src/chapter3/chapter3.tex @@ -2,12 +2,13 @@ \chapter{Paths and pens} \section{Paths} -This plots a function that is generic in that it isn't $f(x)=x^2$ or some -other function derived from a simple expression. -We will use this it for the classic Calculus -lesson of zooming in on a point of tangency to -illustrate that -the curve is locally well-approximated by the line. +This plots a function that is generic in that it isn't +derived from a simple expression such as $\cos x$ or $x+(1/(x-1))$. +We will use it for the classic Calculus +lesson +illustrating that +the curve is locally well-approximated by the line, +by zooming in on a point of tangency. \begin{center} \includegraphics{chapter3/asy/zoom.pdf} \end{center} @@ -24,6 +25,7 @@ so I included a copy in \path{jh.asy} as \mintinline{Asymptote}{GENERIC_FCN_PLOT}.) Earlier, when we drew a vertical asymptote line we instead connected two points with a \mintinline{Asymptote}{--} operator, which gives a line segment. +There are other connectors but these two are the most common. In line~17, \Asy's \mintinline{Asymptote}{dir(..)} command gives the direction of the @@ -40,7 +42,7 @@ As to line~15's \mintinline{Asymptote}{c_time = times(f, c)[0]}, just as \MF{} and \MP{} do. These curves are parametrized by a variable called `time'. -By definition, the initial point $(0,-25)$ is at time~$0$, the next point +By definition, the initial point $(0,-0.25)$ is at time~$0$, the next point $(1,0.35)$ is at time~$1$, etc. (To forestall any confusion:~the time has nothing to do with the first coordinate, it comes from when the point is specified in the @@ -51,7 +53,7 @@ This illustrates, showing some times. \includegraphics{chapter3/asy/zoom_times.pdf} \end{center} The \mintinline{Asymptote}{times(..)} command returns an array of times -where the path it intersects the vertical line +where the path intersects the vertical line $x=\text{\mintinline{Asymptote}{c}}$. We extract the first one (in this case the only one) with the \mintinline{Asymptote}{[0]}. @@ -66,11 +68,11 @@ The source for the prior graphic shows two useful aspects of \begin{center} \inputminted{Asymptote}{chapter3/asy/zoom_times.asy} \end{center} -The first aspect is in line~19. +The first of those is in line~19. The \mintinline{Asymptote}{format("$%0.02f$",t)} turns the floating point number~$t$ into the string used in the label. -A larger point is in lines~17 through~20, where the code has an iteration. +The other is in lines~17 through~20, where the code has an iteration. One strength of \Asy{} is that it is a standard programming language, with clean constructs that are like those you use in other languages in your daily work. @@ -98,8 +100,8 @@ is more complex than the others that we have seen. One reason is that this one file produces four pictures, so that we needn't maintain four separate \path{.asy} files with lots of overlap. -The four output files are produced in the loop between lines~11 and~47. -Line~12 creates a new +The four output files are produced in the loop between lines~17 and~47. +Line~18 creates a new \mintinline{Asymptote}{picture} and line~46 outputs it. The files are named @@ -112,15 +114,15 @@ form of that name is given by the string Besides using a single input to create multiple output files, there are two other things that are new here. -One is line~13's +One is line~19's \mintinline{Asymptote}{size(pic, 3cm, 0)}. -This makes each output graphic be three centimeters wide, and as tall as +This makes each output graphic be three centimeters wide and as tall as required, setting the size of the $x$ and~$y$ units as needed to get that width. The result is a zooming-in on successively shorter intervals of the $x$~axis. The other new thing -is that when the $x$~axis interval is small, rescaling the units to make the +is that rescaling the units to make the entire figure three centimeters wide would put the plotted function very far above the $x$~axis. @@ -128,8 +130,8 @@ So we have moved the function down near the axis. This transformation applies not just to the function but also to the tangent line and to the point $(c,f(c))$, so we have broken this transformation out as a separate thing, -line~32's -\mintinline{Asymptote}{transform f_trans = shift(0,0.5*delta)*shift(0,-1*c_point.y)}. +in line~32. +%\mintinline{Asymptote}{transform f_trans = shift(0,0.5*delta)*shift(0,-1*c_point.y)}. Transformations are applied with the star operator, as on lines~33, 34, and~36. @@ -158,8 +160,8 @@ Here is the resulting graphic. The \mintinline{Asymptote}{buildcycle(left_side, f, right_side, bottom)} on line~20 is new. -It takes the paths surrounding the region of interest and -constructs the path that is its boundary. +It takes paths surrounding the region of interest and +constructs the path that is the region's boundary. (A more common way to make a cyclic path is to end with \mintinline{Asymptote}{cycle}, as with \mintinline{Asymptote}{path triangle = (0,0)--(0,1)--(1,0)--cycle}.) @@ -167,7 +169,7 @@ constructs the path that is its boundary. Then line~23's \mintinline{Asymptote}{fill(region, NEUTRAL_COLOR+opacity(0.5))} covers the region using a pen that, in addition to its color, allows some of the material behind it to show through. -Note that some PDF viewers have trouble with opacity so your results may vary, +Note that some PDF viewers have trouble with opacity so your results may vary but one viewer that gives good results is Adobe's Reader. The \Asy{} reference gives many options for pens. |