Annotation of loncom/html/adm/help/tex/Math_Response_Problems.tex, revision 1.3

1.1       www         1: \label{Math_Response_Problems}
                      2: Math Response is a way to have a problem graded based on an algorithm that is executed inside of a computer algebra system. 
1.3     ! www         3: It is extremely powerful, as it tests answers for conditions rather than agreement with a particular correct answer. An unfortunate
        !             4: byproduct, however, is that it cannot be analyzed by several of the LON-CAPA statistics tools.
1.1       www         5: 
                      6: Which computer algebra system is to be used is specified in the cas argument of the mathresponse tag; currently, only Maxima is available.
                      7: 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.
                      8: 
                      9: The answerdisplay is what is displayed when the problem is in "Show Answer" mode.
                     10: 
                     11: The following example illustrates this.
                     12: \begin{verbatim}
                     13: <problem>
1.2       albertel   14:   <script type="loncapa/perl">
1.1       www        15: $a1 = random(-6,6,4);
                     16: $a2 = random(-6,6,4);
                     17: $n1 = random(3,11,2);
                     18: $n2 = random(2,10,2);
                     19: $function = "$a1*cos($n1*x)+$a2*sin($n2*x)";
1.2       albertel   20: $example=&xmlparse('An example would be <m eval="on">$(sin($n1\cdot x)+cos($n2\cdot x))/\sqrt{2}$</m>');
                     21:   </script>
                     22: 
1.1       www        23: <startouttext />
1.2       albertel   24:   Give an example of a function
                     25:   <ol>
                     26:     <li>
                     27:         which is orthogonal to <algebra>$function</algebra> with respect to the
                     28:         scalar product
                     29:         <m>
                     30:            \[<g \mid h> =
                     31:                \frac{1}{\pi} \int_{-\pi}^{\pi}dx g(x) \cdot h(x)\]
                     32:         </m>
                     33:     </li>
                     34:     <li>
                     35:         whose norm is 1.
                     36:     </li>
                     37:   </ol>
                     38: <endouttext />
                     39: 
1.1       www        40: <mathresponse answerdisplay="$example" cas="maxima" args="$function">
1.2       albertel   41:     <answer>
                     42: overlap:integrate((RESPONSE[1])*(LONCAPALIST[1]),x,-%pi,%pi)/%pi;
1.1       www        43: norm:integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
1.2       albertel   44: is(overlap=0 and norm=1);
                     45:     </answer>
                     46:     <textline readonly="no" size="50" />
                     47:     <hintgroup showoncorrect="no">
                     48:         <mathhint name="ortho" args="$function" cas="maxima">
                     49:             <answer>
                     50: overlap: integrate((LONCAPALIST[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
                     51: is(not overlap = 0);
                     52:             </answer>
                     53:         </mathhint>
                     54:         <mathhint name="norm" args="$function" cas="maxima">
                     55:             <answer>
                     56: norm: integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
                     57: is(not norm = 1);
                     58:             </answer>
                     59:         </mathhint>
                     60:         <hintpart on="norm">
                     61:            <startouttext />
                     62: The function you have provided does not have a norm of one.
                     63:            <endouttext />
                     64:         </hintpart>
                     65:         <hintpart on="ortho">
                     66:             <startouttext />
                     67: The function you have provided is not orthogonal.
                     68:             <endouttext />
                     69:         </hintpart>
                     70:     </hintgroup>
1.1       www        71: </mathresponse>
1.2       albertel   72: 
                     73: 
                     74: <postanswerdate>
                     75:     <startouttext />
                     76:         <p>
                     77: Note that with respect to the above norm, <m>$\cos(nx)$</m> is perpendicular
                     78: to <m>$\sin(nx)$</m> and perpendicular to <m>$\cos(mx)$</m> for
                     79: <m>$n\ne m$</m>.
                     80:         </p>
                     81:     <endouttext />
1.1       www        82: </postanswerdate>
                     83: </problem>
                     84: \end{verbatim}

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