% Sample .tex doc and questions taken from MapleTA and EDU examples.
% MapleTA: www.maplesoft.com
% EDU: www.brownstone.net/support/edu/authoring/
% Thu Dec  1 15:56:51 EST 2005
%
\documentclass[12pt]{article}
\usepackage{ed}
% Optionally set the location for graphics files on the Maple T.A. system.
% \setImageBase{../classes/MapleTAclassname/images_folder/}
\begin{document}
\begin{topic}{Sample-latex-question-types}

\begin{question}{Multiple Choice}
    \qutext{What is the capital of California?}
    % List the choices, and mark the correct choice with an asterisk.
    % Choices are permuted. 
    \choice{San Francisco}
    \choice{Los Angeles}
    \choice*{Sacramento}
\end{question}

\begin{question}{MultipleChoice}
    \qutext{$3\log x-2\log y=$}
    \choice*{$\log\left(\displaystyle\frac{x^3}{y^2}\right)$}
    \choice{$\log(x^3y^2)$}
    \choice{$\log(3x-2y)$}
    \choice{$\log(x^3-y^2)$}
\end{question}

\begin{question}{NonPermutingMultipleChoice}
% This question uses randomized variables.
    \qutext{Consider the function $f(x)=\var{c}x^{\var{n}}$.
    What happens to $f(x)$ as $x\to -\infty$?}
    \choice*{$f(x)\to\infty$}
    \choice{$f(x)\to -\infty$}
    \choice{$f(x)\to 0$}
    \code{
    $n=int(2*rint(4)+3);
    $c=int(-(rint(6)+2));
    }
    % The above code chooses random integer coefficients n and c.
    % The exponent n is positive and odd (3, 5, 7, or 9).
    % The coefficient c is negative, between -2 and -7.
\end{question}

\begin{question}{TrueFalse}
    \qutext{The equation $2x-3y^2=4$ defines a function with an independent
    variable $x$.}
    \false
\end{question}

\begin{question}{TrueFalse}
    % This question uses randomized variables.
    \qutext{The equation $\var{a}x-\var{b}y^2=\var{c}$ defines a function
    with an independent variable $x$.}
    \false
    \code{
    $aa=int(rint(11)+2);
    $s=rint(2);
    $a=int(if($s,$aa,-$aa));
    $b=int(rint(11)+2);
    $cc=int(rint(11)+2);
    $t=rint(2);
    $c=int(if($t,$cc,-$cc));
    }
    % The above code chooses random integer coefficients with absolute values
    % between 2 and 12. b must be positive, but a and c may be
    % positive or negative.
\end{question}

\begin{question}{Matching}
    \qutext{Match the following polynomials with their factorizations:}
    \match{$x^2-1$} \with{$(x-1)(x+1)$}
    \match{$x^2+2x+1$} \with{$(x+1)^2$}
    \match{$x^2-2x+1$} \with{$(x-1)^2$}
    % The optional \decoy terms are presented as extra choices. Take care
    % that they are not possible alternate correct answers!
    \decoy{$(x+1)(x+2)$}
    \decoy{$(x+3)(x+2)$}
    % Optionally, specify the number of columns in which to arrange the display of data.
    \cols{3}
\end{question}

\begin{question}{key words}
    \qutext{Which two scientists independently discovered inductance?}
    \answer{Michael (Faraday) and Joseph (Henry)}
    % Any responses that include both the words "Faraday" and "Henry" is
    % graded correct. If the question is not answered correctly,
    % "Michael Faraday and Joseph Henry" is displayed as the correct answer.
\end{question}

% EDU
% Nested, multi-part questions, default weighing equal.
\begin{question}{Multipart}
    \weighting{1,2} % The value of part (b) is twice that of part (a).
    \qutext{Answer the following questions:}

    % part (a)
    \begin{question}{Formula}
    \qutext{Compute the exact value of $f'(2)$ if $f(x)=x^3+3\cos(x)-1$.}
    \answer{12-3*sin(2)}
    % Any numerical approximation is graded incorrect.
    % Unless, the question allows a number and a possible
    % error bound: \answer{9.27211} or \answer{9.27211 ? 0.00001}
    \end{question}

    % MapleTA
    % part (b)
    \begin{question}{Multipart}
    % The 2/3 of the points assigned to part (b) are split evenly between
    % its subparts because \weighting is not used.
    \numbering{roman} % These are subparts (i) and (ii)

	% part (i)
	\begin{question}{Ntuple}
	\qutext{Find the absolute minimum point on the graph of the
	function $\displaystyle f(x)=\frac{x}{1+x^2}$.}
	\answer{(-1,-1/2)}
	\end{question}

	% part (ii)
	\begin{question}{Ntuple}
	\qutext{Find the absolute maximum point on the graph of the
	function $\displaystyle f(x)=\frac{x}{1+x^2}$.}
        % Answer is a vector of numbers or formulas.
	\answer{(1,1/2)}
	\end{question}
    \end{question}
\end{question}

% MapleTA
% \graph displays a graph of the given formula to the student.
\begin{question}{MultiFormula}
    \qutext{What are the $x$-intercepts of the graph shown?
    % Format: \graph[gridlines]{formula}{xMin}{xMax}{yMin}{yMax}
    \graph[12]{(x-1)(x+3)}{-6}{6}{-6}{6}}
    % The choice of gridlines and scale here will ensure that the axes are
    % labeled at the integers -6, -5, ..., -1, 1, ..., 5, 6.
    % Unordered list of numbers or formulas is checked.  All or nothing?
    \answer{1;-3}
\end{question}

% MapleTA
% Sketch question asks for points to connect to form a requested graph.
\begin{question}{sketch}
    \code{$a = int(rand(2,6));
	  $a2 = int($a*$a);
	  $xmax = int(2*$a);
	  $x = sqrt(2)*$a;}
    \qutext{Sketch the graph of the function $y=x^2/\var{a2}$.}
    \begin{sketch}[4]{-\var{xmax}}{\var{xmax}}{-4}{4}
      \example{-\var{x},2  -\var{a},1  0,0  \var{a},1  \var{x},2}
      \check{goes_through(0,0) && goes_through(-\var{a},1)
	     && goes_through(\var{a},1)}
      \check{slope_at(0) == 0}
      \check[-\var{x},0]{decreasing}
      \check[0,\var{x}]{increasing}
      \check{concave_up}
    \end{sketch}
\end{question}

\begin{question}{Matrix}
    % This question uses randomized variables.
    \qutext{Find the transpose of the matrix
    $$A=\left[\begin{array}{ccc} \var{a} & \var{b} & \var{c}\\
    \var{d} & \var{e} & \var{f}\end{array}\right]$$}
    % For checking, specify the number of rows of the answer, and 
    % then the number of columns.
    \size{3}{2}
    % Students answer with a comma-separated list, starting with the first row.
    % The list can be linear in shape.
    \size{3}{2}
    \answer{\var{a}, \var{d},
	    \var{b}, \var{e},
	    \var{c}, \var{f}}
    \code{
    $a=int(rint(19)-9);
    $b=int(rint(19)-9);
    $c=int(rint(19)-9);
    $d=int(rint(19)-9);
    $e=int(rint(19)-9);
    $f=int(rint(19)-9);
    }
    % The above code chooses six random integer coefficients a, b, c, d, e,
    % and f, between -9 and 9.
\end{question}


\end{topic}

\end{document}
