Maxima style

QUESTION. Find the equation for the parabola shown below.

\includegraphics{qgmax_plot0.ps}

In this example we expect students to know that the two $ x$-intercepts $ x_0$ and $ x_1$ formulates the quadratic equation $ y = a(x-x_0)(x-x_1)$, and then identify $ a$ from the third point (for which the vertex is a good choice). Here we will create any number of different problems by changing the values $ a$, $ x_0$ and $ x_1$. We can also form incorrect answers such as $ y = -a(x-x_0)(x-x_1)$, $ y = -(x-x_0)(x-x_1)$, and $ y = (x-x_0)(x-x_1)$. The following thisquiz.tex in ``Quiz 1'' illustrates this point, and realizes it in Maxima-embedded LATEX document.

\textsc{Question.} Find the equation for the parabola shown below.

\maximacode
  pick([list]) := block([i], i:random(length(list))+1, return(list[i]));
  a: pick(-2,1/2);
  x0: pick(-2,0,1);
  x1: pick(2,3,4);
\endmaximacode

\begin{center}
\maximaplot [a*(x-x0)*(x-x1),x0-1,x1+1] \endmaximaplot
\end{center}

\begin{enumerate}
\item
\maxima expand(a*(x-x0)*(x-x1)) \endmaxima
\item
\maxima expand(-a*(x-x0)*(x-x1)) \endmaxima
\item
\maxima expand((x-x0)*(x-x1)) \endmaxima
\item
\maxima expand(-(x-x0)*(x-x1)) \endmaxima
\end{enumerate}

Maxima code, a set of maxima expressions, is placed between \maximacode and \endmaximacode. In a similar manner a single maxima expression is placed between \maxima and \endmaxima. While the maxima code in the first control sequence has no output, the maxima expression in the second one is replaced by the math mode $ output $ and the TEX-mathmode output will be inserted. In either case if we run latex with qgmax.sty, it shows no effect of Maxima evaluation.

\maximacode
maxima code;
.........
maxima code;
\endmaximacode

\maxima maxima expression \endmaxima

Plotting is controlled by \maximaplot and \endmaximaplot. The maxima expressions in this control sequence is first evaluated by Maxima, and passed onto gnuplot.

\maximaplot

[f(x), x-axis lower limit, x-axis upper limit]

\endmaximaplot

The comma-separated values ``f(x)'', ``x-axis lower limit'', and ``x-axis upper limit'' are Maxima expression, not allowed to contain commas (``,'') themselves. Other form of control sequence may be chosen from one of the following:

[f(x), x-axis lower limit, x-axis upper limit, y-axis lower limit, y-axis upper limit]

[parametric, lower end of t, upper end of t, f(t) in x-axis, g(t) in y-axis, .....]

[parametric, lower end of t, upper end of t, xrange, x-axis lower limit, x-axis upper limit, f(t) in x-axis, g(t) in y-axis, .....]

[parametric, lower end of t, upper end of t, xrange, x-axis lower limit, x-axis upper limit, yrange, y-axis lower limit, y-axis upper limit, f(t) in x-axis, g(t) in y-axis, .....]

We created a page ``Quiz 1'' for the above example, and linked it as follows:

\subsection{[../Quiz_1/quiz.cgi]Quiz 1}

Note that the path to this page is /MATHGO/Guide_to_GO/thispage/ and Quiz 1 is placed under /MATHGO/Guide_to_GO/Quiz_1/. We have the relative path ../Quiz_1 to access thisquiz.tex. The perl CGI script quiz.cgi will evaluate thisquiz.tex with Maxima, generate HTML, and display it in the window.



Department of Mathematics
Last modified: 2005-07-18