diff options
Diffstat (limited to 'macros/latex/contrib/acroflex/examples/afgraph.tex')
-rw-r--r-- | macros/latex/contrib/acroflex/examples/afgraph.tex | 412 |
1 files changed, 412 insertions, 0 deletions
diff --git a/macros/latex/contrib/acroflex/examples/afgraph.tex b/macros/latex/contrib/acroflex/examples/afgraph.tex new file mode 100644 index 0000000000..62d8be729a --- /dev/null +++ b/macros/latex/contrib/acroflex/examples/afgraph.tex @@ -0,0 +1,412 @@ +\documentclass{article} +\usepackage{amsmath} +\usepackage[% + web={pro,tight,usesf}, + eforms,exerquiz,dljslib={ImplMulti}, + graphicxsp={showembeds} +]{aeb_pro} +\usepackage{acroflex} +\usepackage{wrapfig} + +\margins{.25in}{.25in}{24pt}{.25in} % left,right,top, bottom +\screensize{5in}{5.5in} % height, width dimensions + + +\DeclareDocInfo +{ + title=\texorpdfstring{{\AcroFLeX}}{AcroFleX} Graphing System, + author=D. P. Story, + university=Acro\negthinspace\TeX.Net, + email=dpstory@acrotex.net, + subject=Demo of the acroflex and the rmannot package, + keywords={Adobe Acrobat, JavaScript, Adobe FLEX 3, ActionScript}, + talksite=\url{http://www.acrotex.net}, + talkdate={July 2008}, + copyrightStatus=True, + copyrightNotice={Copyright (C) \the\year, D. P. Story}, + copyrightInfoURL=http://www.acrotex.net +} +\talkdateLabel{Published:} + +\setWindowOptions{showtitle} + +\requiredVersionMsg{% + Version 9 required: This document may be viewed, but version 9 + of Acrobat/Adobe Reader is required to view the rich media + annotations present in this document.} +\requiredVersionMsgRedirect{% + Version 9 required: This document may be viewed, but version 9 + of Acrobat/Adobe Reader is required to view the rich media + annotations present in this document.} +\requiresVersion[warnonly]{9} + +\def\AcroTeX{Acro\!\TeX} +\def\myURL{http://www.math.uakron.edu/\string~dpstory} +% +% The following definitions are for the rmannot package. +% The \saveNamedPath associates the name AcroAd with the +% path to a Flash animation, Acro_Advertiser.swf. +% The two \makePoster definitions are for the posters of the +% rich media annotations. The first for the animation on page 1 +% and the second for all the AcroFlex graphing screens. +\newcommand{\myRMFiles}{C:/Users/Public/Documents/My TeX Files/% + tex/latex/aeb/aebpro/rmannot/RMfiles} +\saveNamedPath{AcroAd}{\myRMFiles/Acro_Advertiser.swf} +% +% See the rmannot documentation. You can create your own +% poster graphic and declare it in the preamble. +% +\makePoster[hiresbb]{aflogo}{aflogo} +\makePoster[hiresbb]{AcroAd_poster}{AcroAd_poster} + +\parindent=0pt +\pagestyle{empty} %\previewtrue +\def\graphAndControls{\kern0pt\noindent + \graphScreen[poster=aflogo]{\hScreenGraph}{\vScreenGraph}\\[1ex] + \makebox[\hScreenGraph][l]{% + \savedelSelBtn[\textSize{7}\CA{S}]{9bp}{11bp}\kern1bp + \functionSelect{50bp}{11bp}\hfill + \funcInputField{\hScreenGraph-50bp-6bp-9bp}{11bp}% + }\\[1ex] + \makebox[\hScreenGraph][c]{\scriptsize + \graphBtn[\textSize{7}]{}{9bp}\kern1pt + \graphClrBtn[\textSize{7}]{}{9bp}\hfill + \hShiftL{\raisebox{1bp}{\reflectbox{\ding{220}}}}\,% + \vShiftU{\raisebox{1bp}{\rotatebox{90}{\ding{220}}}}\,\,% + \amtShift[\textSize{7}]{12bp}{9bp}\,\,% + \vShiftD{\raisebox{1bp}{\rotatebox[origin=c]{-90}{\ding{220}}}} + \hShiftR{\raisebox{1bp}{\ding{220}}}\enspace + \hfill\zoomInOut[\textSize{7}]{}{9bp}% + }\\[1pt]% + \makebox[\hScreenGraph][l]{\scriptsize + $x = $ \strut\domMin[\textSize{7}]{36bp}{9bp}\ldots + \domMax[\textSize{7}]{36bp}{9bp}\hfill + $n = $\numPoints[\textSize{7}]{16bp}{9bp} + }\\[1pt]% + \makebox[\hScreenGraph][l]{\scriptsize + $y = $ \rngMin[\textSize{7}]{36bp}{9bp}\ldots + \rngMax[\textSize{7}]{36bp}{9bp}% + }\\[1pt]%% + \makebox[\hScreenGraph][l]{\scriptsize + $t = $ \strut\domMinP[\textSize{7}]{36bp}{9bp}\ldots + \domMaxP[\textSize{7}]{36bp}{9bp}% + } +\par +} +% +% Display an advertisement on the opening page through the +% \optionalPageMatter command. +% +\optionalPageMatter{% +\begin{center} +\begin{minipage}{.7\linewidth} + \resizebox{\linewidth}{!}{% + \rmAnnot[poster=AcroAd_poster,enabled=pageopen]{612bp}{265bp}{AcroAd}}% +\end{minipage} +\end{center} +} + +\begin{document} + +\maketitle + +\parskip6pt +\begin{center} + \large\bfseries\color{blue} What is {\AcroFLeX}? +\end{center} + +The word \textbf{\AcroFLeX} is meant to convey a merging of two computer technologies: + \begin{itemize} + \item \textbf{Acro}: connotes both \textbf{Adobe Acrobat} (\textbf{Adobe Reader}) + and \textbf{{Acro\negthinspace\TeX}} (as in the + \textbf{{Acro\negthinspace\TeX} eDucation Bundle} or, just \textbf{AeB}). + \item \textbf{F\kern-.1667em\lower.5ex\hbox{L}\kern-.3eme\kern-.125emX\@}: connotes + \textbf{Adobe FLEX 3}. FLEX 3 is used to create SWF files to interact with the user. + In the case of graphing, plotting information is passed from Acrobat, via JavaScript, + to the Flash widget. ActionScript takes the data, plots the points provided, and + connects them with a smooth curve. + \end{itemize} + +\textbf{\textcolor{blue}{{\AcroFLeX} by Acro\!\TeX:}} This graphing +system and this demonstration file were developed by D.~P. Story +using the \href{http://www.ctan.org/pkg/acrotex}{{Acro\!\TeX} eDucation +Bundle}, \href{http://www.adobe.com/products/acrobat/} +{$\text{Adobe}^{\text{\tiny\circledR}}$ +$\text{Acrobat}^{\text{\tiny\circledR}}$~9 Pro}, and +\href{http://www.adobe.com/products/flex/}{$\text{Adobe}^{\text{\tiny\circledR}}$ +$\text{FLEX}^{\text{\tiny TM}}$~3}. + +Acrobat 9 Pro introduces the rich media annotation that plays FLV +movies and SWF files natively. Acrobat also provides a scripting +bridge between JavaScript for Acrobat, and ActionScript, the +scripting language of Flash player. This bridge enables the PDF and +the Flash widget, embedded in the rich media annotation, to +communicate. The scripting bridge opens up wonderful opportunities +for application to the education sector. The graphing of {\AcroFLeX} +is one such application of the new PDF-Flash connection to +education. + +\textbf{{\AcroFLeX}} uses the commercial product Adobe FLEX +Builder~3 and FLEX~3 SDK to produce Flash widgets, and the AeB to +create PDF documents with appropriate JavaScript to communicate with +the Flash widget. FLEX Builder~3 is currently free for students and +educators, the FLEX 3 SDK is free to all. + +\newpage +\parskip0pt + +% Basic parameters. These are the graphing screen dimensions you wish +% for the AcroFleX graphing widget, and the \graphName is the base name used by +% all the supporting components to the graphing screen. + +\dimScreenGraph{186bp}{186bp*3/4} +\graphName{graph1} + +\begin{center}\bfseries\Large\color{blue} + {\AcroFLeX} by {\AcroTeX} +\end{center} + +\medskip +The first goal in {\AcroFLeX} development was to build an interactive graphing +screen educators could use in their PDFs. +\medskip + +\begin{minipage}[t]{\hScreenGraph + 10bp} +% +% Insert the \graphScreen with all possible controls. Plot data entered by the +% user is interactive mode. +\graphAndControls +\medskip +% +% Pass plot data to this graphing screen, and allow user to interact with it. +% +\makebox[\linewidth][c]{\textbf{Populate Mode}} +Parametric Equations: \sgraphLink{xInterval={[-1,1]},yInterval={[-1,1]},tInterval={[0,2*pi]}, + points=40,populate=true}{cos(t);sin(t)}{$x=\cos(t)$; $y=\sin(t)$}\\[1ex] +Polar Function: \sgraphLink{type=polar,xInterval={[-1.5,1.5]},yInterval={[-1,2]},tInterval={[0,2*pi]}, + points=60,populate=true}{1+sin(t)}{$r = 1 + \sin(\theta)$ } +\end{minipage}\hfill +\begin{minipage}[t]{\linewidth - \hScreenGraph - 10bp}\small\par +\textbf{\textcolor{red}{Instructions:}} This graphing system can graph +a function of $x$, a pair of parametric functions of $t$, +or a polar function of $t$. +\begin{questions} + \item For a function of $x$, enter an algebraic expression to be graphed, e.g., + \verb!3x^2-1!, \verb!4sin(2x)!, \verb!ln(x)!, + \verb!e^(x+1)!. For parametric equations, two functions of + $t$ separated by a semicolon (;) e.g., + \texttt{cos(t);sin(t)}. For a polar function, enter a single + expression that is a function of $t$, e.g., + \texttt{1+sin(t)}. + \item Set the graph viewing window: The range of the horizontal + axis ($x$-axis) and range of the vertical axis ($y$-axis). + For parametric plotting, set the range of the $t$ variable. + \item Enter the number of points, $n$, to plot. + \item Click the \textsf{Graph It!} button. + \item Shift the viewing window horizontally or vertical; + or zoom in or out. + \item Click \texttt{Clear} to clear the plot; use + \textsf{shift-click} to deactivate the graphing screen. +\end{questions} +\end{minipage} + +\def\DomX{[0,2pi]}\def\DomY{[-1,1+.2]} + +%\end{document} + +\newpage +\graphName{graph2} +\begin{center} + {\large\textbf{\textcolor{blue}{Graphing Predefined Functions}}}\\[3ex] + \graphScreen[poster=aflogo]{\hScreenGraph}{\vScreenGraph}\par\smallskip + \makebox[\hScreenGraph][c]{\small\graphClrBtn{}{11bp}} +\end{center} + +\begin{center} + \rule{.67\linewidth}{.4pt} +\end{center} +The document author, that's you, can prepare some functions for the student to view: +\sgraphLink{xInterval={\DomX},yInterval={\DomY},points=40}{sin(x)}{$\sin(x)$}, +\sgraphLink{xInterval={\DomX},yInterval={\DomY},points=80}{sin(2x)}{$\sin(2x)$}, +\sgraphLink{xInterval={\DomX},yInterval={\DomY},points=100}{sin(3x)}{$\sin(3x)$}, and +\sgraphLink{xInterval={\DomX},yInterval={\DomY},points=100}{sin(4x)}{$\sin(4x)$}. +All functions are graphed over the interval +$[\,0, 2\pi\,]$. Let's view a graph with a vertical asymptote, shall we? +Try \sgraphLink{xInterval={[.5,1.5]},yInterval={[-20,20]},points=200}{1/(x-1)}{$y = 1/(x-1)$} +and \sgraphLink{xInterval={[0,2]},yInterval={[0,20]},points=200}{1/(x-1)^2}{$y = 1/(x-1)^2$}. + +\smallskip +\begin{center} + \rule{.67\linewidth}{.4pt} +\end{center} +\begin{shortquiz} +What type of symmetry does the \sgraphLink{xInterval={[-pi,pi]},yInterval={[-1,1]}, +points=40}{sin(x)}{function}, graphed above, have? +\begin{answers}{3} +\Ans0 $x$-axis symmetry & \Ans0 $y$-axis symmetry & \Ans1 origin symmetry +\end{answers} +\end{shortquiz} + +\newpage +\graphName{graph3} + +\begin{center} + {\large\textbf{\textcolor{blue}{Multiple Curves and Plots}}}\\[3ex] + \graphScreen[poster=aflogo]{\hScreenGraph}{\vScreenGraph}\par\smallskip + \makebox[\hScreenGraph][c]{\small\graphClrBtn{}{11bp}} +\end{center} + +\smallskip +\begin{center} + \rule{.67\linewidth}{.4pt} +\end{center} + +Plot multiple curves using predefined functions: +\begin{itemize} + \item \sgraphLink{graph=c1,xInterval={\DomX},yInterval={\DomY},points=40}{sin(x)}{$\sin(x)$}, + \sgraphLink{graph=c2,xInterval={\DomX},yInterval={\DomY},points=80}{sin(2x)}{$\sin(2x)$}, + \sgraphLink{graph=c3,xInterval={\DomX},yInterval={\DomY},points=100}{sin(3x)}{$\sin(3x)$}, + \sgraphLink{graph=c4,xInterval={\DomX},yInterval={\DomY},points=100}{sin(4x)}{$\sin(4x)$}. +\end{itemize} + +Let's plot some points: +\begin{itemize} + +\item Points on \sgraphLink{graph=p1,xInterval={\DomX},yInterval={\DomY}}{(0,sin(0));(pi/2,sin(pi/2));(pi,sin(pi));(3pi/2,sin(3pi/2));(2pi,sin(2pi))}{$\sin(x)$} +(clear the graphing screen, click on this \sgraphLink{graph=c1,xInterval={\DomX},yInterval={\DomY},points=40}{sin(x)}{$\sin(x)$} +link, then click on the plotted points link) + + +\item Plot \sgraphLink{graph=p2,xInterval={\DomX},yInterval={\DomY}}{(1,1);(2,-1);(4,1/3);(3,-1/2)} + {$(1,1); (2,-1); (4,1/3); (3,-1/2)$} + +\item Plot \sgraphLink{graph=c2,connectwith=segment,xInterval={\DomX},yInterval={\DomY}}{(2,0);(1,-1);(3,.5);(4,1);(6,0)} + {$(2,0);(1,-1);(3,.5);(4,1);(6,0)$} + +\end{itemize} + +\newpage + +\graphName{graph4} + +\begin{center} + {\large\textbf{\textcolor{blue}{Graphing in a Floating Window}}} +\end{center} + +\begin{wrapfigure}[3]{l}{40bp}% +\vspace{-\baselineskip} +\iconFloatGraphScreen[poster=aflogo]{40bp}{!} +\end{wrapfigure}% +On this page, we take a different approach, by graphing functions +in a \textsl{floating window}. This might be appropriate for graphing +preset functions. Now let's copy and paste some of the previous text +here: The document author, that's you, can prepare some functions +for the student to view: +\sgraphLink{xInterval={\DomX},yInterval={\DomY},points=40}{sin(x)}{$\sin(x)$}, +\sgraphLink{xInterval={\DomX},yInterval={\DomY},points=80}{sin(2x)}{$\sin(2x)$}, +\sgraphLink{xInterval={\DomX},yInterval={\DomY},points=100}{sin(3x)}{$\sin(3x)$}, and +\sgraphLink{xInterval={\DomX},yInterval={\DomY},points=100}{sin(4x)}{$\sin(4x)$}. +All functions are graphed over the interval +$[\,0, 2\pi\,]$. Let's view a graph with a vertical asymptote, shall we? +Try \sgraphLink{xInterval={[.5,1.5]},yInterval={[-20,20]},points=200}{1/(x-1)}{$y = 1/(x-1)$} +and \sgraphLink{xInterval={[0,2]},yInterval={[0,20]},points=200}{1/(x-1)^2}{$y = 1/(x-1)^2$}. + + +\makebox[\linewidth][c]{\rule{.67\linewidth}{.4pt}} + +\parskip6pt + +\paragraph*{Controlling the Floating Window.} Clicking a graphing +link will open the floating window and graph the defined function. +Clicking the {\AcroFLeX} icon closes the window. The window itself +has controls. The clicking the upper-right corner closes the window. +Use the lower-left corner to resize the graph window (click and drag +the lower-left corner). Click and drag anywhere else on the boundary +will move the window. + +\makebox[\linewidth][c]{\rule{.67\linewidth}{.4pt}} + +The following quiz integrates the quiz/shortquiz environment with +the {\AcroFLeX} Graphing routines, and uses \texttt{\string\defineGraphJS} +to graph the input of the user. + +\begin{oQuestion}{afGraphQuiz} +\defineGraphJS{graph=c3,xInterval={[-1,3]},yInterval={[-1,9]}, + noquotes,points=40}{event.value}{\myGraph}% +\textbf{\textcolor{red}{Question}} Find the equation of the line +tangent to the \sgraphLink{xInterval={[-1,3]}, +yInterval={[-1,9]},points=40}{2x^2}{graph of $f(x) = 2x^2 $} at the +\sgraphLink{graph=p1,xInterval={[-1,3]},yInterval={[-1,9]}}{(1,2)} + {point $ (1,2) $}. \RespBoxMath[% + \AddAAKeystroke{if (retn != null){\r\myGraph}}] + {4x-2}{4}{.0001}{[-1,3]}\hfill\CorrAnsButton{4x-2}\kern1bp\sqClearButton + +\end{oQuestion} + +\defineGraphJS{graph=c1,wait,xInterval={\DomX},yInterval={\DomY}, + points=40}{sin(x)}{\mySineCurve} +\defineGraphJS{graph=p1,wait,xInterval={\DomX},yInterval={\DomY}} + {(0,sin(0));(pi/2,sin(pi/2));(pi,sin(pi));(3pi/2,sin(3pi/2)); + (2pi,sin(2pi))}{\mySinePoints} + +Below is another example of the use of +\texttt{\string\defineGraphJS}. A link is created with two calls to +the graphing routines, one to plot a sine curve, the other to plot +points on that curve. +\setLinkText[\A{\JS{% + \clearGraphJS\r + \mySineCurve\r + \mySinePoints +}}]{Consider the sine function, and indicated points}% + + +\newpage + +\graphName{graph5} + +\begin{center} + {\large\textbf{\textcolor{blue}{Curves with filled area}}}\\[3ex] + \graphScreen[poster=aflogo]{\hScreenGraph}{\vScreenGraph}\par\smallskip + \makebox[\hScreenGraph][c]{\small\graphClrBtn{}{11bp}} +\end{center} + +Plot multiple curves using predefined functions:\\ +\begin{minipage}[t]{.5\linewidth-10pt}\kern0pt +\begin{itemize} + \item \sgraphLink{graph=a1,xInterval={\DomX},yInterval={\DomY},points=40}{sin(x)}{$\sin(x)$}, + \sgraphLink{graph=a2,xInterval={\DomX},yInterval={\DomY},points=80}{sin(2x)}{$\sin(2x)$}, + \sgraphLink{graph=a3,xInterval={\DomX},yInterval={\DomY},points=100}{sin(3x)}{$\sin(3x)$}, + \sgraphLink{graph=a4,xInterval={\DomX},yInterval={\DomY},points=100}{sin(4x)}{$\sin(4x)$}. + \item Parametric Equations + \begin{itemize} + \item \sgraphLink{graph=a1,xInterval={[-1,1]},yInterval={[-1,1]},tInterval={[0,2*pi]}, + points=40}{cos(t);sin(t)}{$x=\cos(t)$; $y=\sin(t)$} + \item \sgraphLink{graph=a3,xInterval={[0,4]},yInterval={[-2,2]},tInterval={[-2,2]}, + points=40}{t^2;t}{$x=t^2$; $y=t$} + \end{itemize} +\end{itemize} +\end{minipage}\hfill\begin{minipage}[t]{.5\linewidth-10pt}\kern0pt +\begin{itemize} + \item Polar Functions + \begin{itemize} + \item \sgraphLink{graph=a2,type=polar,xInterval={[-1.5,1.5]},yInterval={[-1,2.3]},tInterval={[0,2pi]}, + points=60}{1+sin(t)}{$ r = 1 + \sin(\theta) $ } + \item \sgraphLink{graph=a4,type=polar,xInterval={[-1.5,1.5]},yInterval={[-1,2.3]},tInterval={[0,2pi]}, + points=60}{1+1.25sin(t)}{$r = 1 + 1.25\sin(\theta)$ } + \end{itemize} +\end{itemize} +\end{minipage} + +\begin{oQuestion}{afAreaQuiz} +\textbf{\textcolor{red}{Question}} Find the area of the region +\emph{below} the graph of \sgraphLink{graph=a1,xInterval={[0,pi/2]}, +yInterval={[0,1.1]}, points=40}{cos(x)}{$ f(x) = \cos(x) $} and +\emph{above} the graph of \sgraphLink{graph=a2, +xInterval={[0,pi/2]}, yInterval={[0,1.1]}, points=40}{sin(x)}{$ g(x) += \sin(x) $}, +as shown in the graph screen above.\\[1ex] +\RespBoxMath{sqrt(2)-1}{1}{.0001}{[0,1]}\hfill\CorrAnsButton{sqrt(2)-1}\kern1bp\sqClearButton +\end{oQuestion} + + +\end{document} |