\label{Creating_Math_Response_Problems}\index{Math Response} Math response problems use a cas system to evaluate the student response. Which computer algebra system is to be used is specified in the cas argument of the mathresponse tag; both Maxima and R are supported. Maxima and R are also powerful stand-alone programs that can be installed on most operating systems. If you are interested in writing Maxima or R problems, it is a good idea to install a copy on your operating system to access help, learn syntax, and test your expected responses outside the LON-CAPA environment. See \texttt{http://maxima.sourceforge.net/} or \texttt{http://www.r-project.org/} . LON-CAPA will accept two pre-named arrays inside the answerblock for the computer algebra system: RESPONSE and LONCAPALIST. RESPONSE contains the student input by comman-separated entities, for example, if ``3,42,17'' is entered by the student, RESPONSE[2] would be 42. LONCAPALIST is built from the arguments passed in an array \texttt{args} which is assigned a array value from the script. The \texttt{answer} tag contains the Maxima command (and syntax) that are passed to Maxima after the RESPONSE and LONCAPALIST values are substituted. (See example below). The \texttt{answerdisplay} variable contains what is displayed when the problem is in ``Show Answer'' mode. You will want to include this field so that the students can see the correct answer after the ``Show Answer Date'' configured when the problem is assigned in the course space. Also note the description in the \texttt{postanswerdate}\index{postanswerdate} tag that is displayed after the answer date. The following example illustrates this. \begin{verbatim} Give an example of a function
  1. which is orthogonal to $function with respect to the scalar product \[ = \frac{1}{\pi} \int_{-\pi}^{\pi}dx g(x) \cdot h(x)\]
  2. whose norm is 1.
overlap:integrate((RESPONSE[1])*(LONCAPALIST[1]),x,-%pi,%pi)/%pi; norm:integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi; is(overlap=0 and norm=1); overlap: integrate((LONCAPALIST[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi; is(not overlap = 0); norm: integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi; is(not norm = 1); The function you have provided does not have a norm of one. The function you have provided is not orthogonal.

Note that with respect to the above norm, $\cos(nx)$ is perpendicular to $\sin(nx)$ and perpendicular to $\cos(mx)$ for $n\ne m$.

\end{verbatim}