Annotation of loncom/html/adm/help/tex/Creating_Math_Response_Problems.tex, revision 1.1

1.1     ! lira        1: \label{Creating_Math_Response_Problems}
        !             2: 
        !             3: 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; currently, only Maxima is available.
        !             4: LON-CAPA sets up two arrays inside 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 contains the arguments passed in the args of mathresponse passed from the script in an vector.
        !             5: 
        !             6: The answerdisplay tag 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.
        !             7: 
        !             8: The following example illustrates this.
        !             9: \begin{verbatim}
        !            10: <problem>
        !            11:   <script type="loncapa/perl">
        !            12: $a1 = random(-6,6,4);
        !            13: $a2 = random(-6,6,4);
        !            14: $n1 = random(3,11,2);
        !            15: $n2 = random(2,10,2);
        !            16: $function = "$a1*cos($n1*x)+$a2*sin($n2*x)";
        !            17: $example=&xmlparse('An example would be <m eval="on">$(sin($n1\cdot x)+cos($n2\cdot x))/\sqrt{2}$</m>');
        !            18:   </script>
        !            19: 
        !            20: <startouttext />
        !            21:   Give an example of a function
        !            22:   <ol>
        !            23:     <li>
        !            24:         which is orthogonal to <algebra>$function</algebra> with respect to the
        !            25:         scalar product
        !            26:         <m>
        !            27:            \[<g \mid h> =
        !            28:                \frac{1}{\pi} \int_{-\pi}^{\pi}dx g(x) \cdot h(x)\]
        !            29:         </m>
        !            30:     </li>
        !            31:     <li>
        !            32:         whose norm is 1.
        !            33:     </li>
        !            34:   </ol>
        !            35: <endouttext />
        !            36: 
        !            37: <mathresponse answerdisplay="$example" cas="maxima" args="$function">
        !            38:     <answer>
        !            39: overlap:integrate((RESPONSE[1])*(LONCAPALIST[1]),x,-%pi,%pi)/%pi;
        !            40: norm:integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
        !            41: is(overlap=0 and norm=1);
        !            42:     </answer>
        !            43:     <textline readonly="no" size="50" />
        !            44:     <hintgroup showoncorrect="no">
        !            45:         <mathhint name="ortho" args="$function" cas="maxima">
        !            46:             <answer>
        !            47: overlap: integrate((LONCAPALIST[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
        !            48: is(not overlap = 0);
        !            49:             </answer>
        !            50:         </mathhint>
        !            51:         <mathhint name="norm" args="$function" cas="maxima">
        !            52:             <answer>
        !            53: norm: integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
        !            54: is(not norm = 1);
        !            55:             </answer>
        !            56:         </mathhint>
        !            57:         <hintpart on="norm">
        !            58:            <startouttext />
        !            59: The function you have provided does not have a norm of one.
        !            60:            <endouttext />
        !            61:         </hintpart>
        !            62:         <hintpart on="ortho">
        !            63:             <startouttext />
        !            64: The function you have provided is not orthogonal.
        !            65:             <endouttext />
        !            66:         </hintpart>
        !            67:     </hintgroup>
        !            68: </mathresponse>
        !            69: 
        !            70: 
        !            71: <postanswerdate>
        !            72:     <startouttext />
        !            73:         <p>
        !            74: Note that with respect to the above norm, <m>$\cos(nx)$</m> is perpendicular
        !            75: to <m>$\sin(nx)$</m> and perpendicular to <m>$\cos(mx)$</m> for
        !            76: <m>$n\ne m$</m>.
        !            77:         </p>
        !            78:     <endouttext />
        !            79: </postanswerdate>
        !            80: </problem>
        !            81: \end{verbatim}

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