File:  [LON-CAPA] / loncom / html / adm / help / tex / Math_Response_Problems.tex
Revision 1.2: download - view: text, annotated - select for diffs
Tue May 22 00:55:09 2007 UTC (17 years, 1 month ago) by albertel
Branches: MAIN
CVS tags: version_2_9_X, version_2_9_99_0, version_2_9_1, version_2_9_0, version_2_8_X, version_2_8_99_1, version_2_8_99_0, version_2_8_2, version_2_8_1, version_2_8_0, version_2_7_X, version_2_7_99_1, version_2_7_99_0, version_2_7_1, version_2_7_0, version_2_6_X, version_2_6_99_1, version_2_6_99_0, version_2_6_3, version_2_6_2, version_2_6_1, version_2_6_0, version_2_5_X, version_2_5_99_1, version_2_5_99_0, version_2_5_2, version_2_5_1, version_2_5_0, version_2_4_X, version_2_4_99_0, version_2_4_2, version_2_4_1, version_2_4_0, version_2_10_X, version_2_10_1, version_2_10_0_RC2, version_2_10_0_RC1, version_2_10_0, loncapaMITrelate_1, language_hyphenation_merge, language_hyphenation, bz6209-base, bz6209, bz5969, bz2851, PRINT_INCOMPLETE_base, PRINT_INCOMPLETE, HEAD, GCI_3, GCI_2, GCI_1, BZ5971-printing-apage, BZ5434-fox, BZ4492-merge, BZ4492-feature_horizontal_radioresponse
- add whitespace for clatrity

\label{Math_Response_Problems}
Math Response is a way to have a problem graded based on an algorithm that is executed inside of a computer algebra system. 
The use of this response type is
generally discouraged, since the responses will not be analyzable by the LON-CAPA statistics tools.

Which computer algebra system is to be used is specified in the cas argument of the mathresponse tag; currently, only Maxima is available.
LON-CAPA sets up two arrays inside the computer algebra system: RESPONSE and LONCAPALIST. RESPONSE contains the student input by component, for example, if "3,42,17" is entered, RESPONSE[2] would be 42. LONCAPALIST contains the arguments passed in the args of mathresponse.

The answerdisplay is what is displayed when the problem is in "Show Answer" mode.

The following example illustrates this.
\begin{verbatim}
<problem>
  <script type="loncapa/perl">
$a1 = random(-6,6,4);
$a2 = random(-6,6,4);
$n1 = random(3,11,2);
$n2 = random(2,10,2);
$function = "$a1*cos($n1*x)+$a2*sin($n2*x)";
$example=&xmlparse('An example would be <m eval="on">$(sin($n1\cdot x)+cos($n2\cdot x))/\sqrt{2}$</m>');
  </script>

<startouttext />
  Give an example of a function
  <ol>
    <li>
        which is orthogonal to <algebra>$function</algebra> with respect to the
        scalar product
        <m>
           \[<g \mid h> =
               \frac{1}{\pi} \int_{-\pi}^{\pi}dx g(x) \cdot h(x)\]
        </m>
    </li>
    <li>
        whose norm is 1.
    </li>
  </ol>
<endouttext />

<mathresponse answerdisplay="$example" cas="maxima" args="$function">
    <answer>
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);
    </answer>
    <textline readonly="no" size="50" />
    <hintgroup showoncorrect="no">
        <mathhint name="ortho" args="$function" cas="maxima">
            <answer>
overlap: integrate((LONCAPALIST[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
is(not overlap = 0);
            </answer>
        </mathhint>
        <mathhint name="norm" args="$function" cas="maxima">
            <answer>
norm: integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
is(not norm = 1);
            </answer>
        </mathhint>
        <hintpart on="norm">
           <startouttext />
The function you have provided does not have a norm of one.
           <endouttext />
        </hintpart>
        <hintpart on="ortho">
            <startouttext />
The function you have provided is not orthogonal.
            <endouttext />
        </hintpart>
    </hintgroup>
</mathresponse>


<postanswerdate>
    <startouttext />
        <p>
Note that with respect to the above norm, <m>$\cos(nx)$</m> is perpendicular
to <m>$\sin(nx)$</m> and perpendicular to <m>$\cos(mx)$</m> for
<m>$n\ne m$</m>.
        </p>
    <endouttext />
</postanswerdate>
</problem>
\end{verbatim}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>