Annotation of loncom/html/adm/help/tex/Math_Response_Problems.tex, revision 1.1
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.
! 3: The use of this response type is
! 4: generally discouraged, since the responses will not be analyzable by the LON-CAPA statistics tools.
! 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>
! 14: <script type="loncapa/perl">
! 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)";
! 20: $example=&xmlparse('An example would be <m eval="on">$(sin($n1\cdot x)+cos($n2\cdot x))/\sqrt{2}$</m>');</script>
! 21: <startouttext />
! 22: Give an example of a function
! 23: <ol>
! 24: <li>which is orthogonal to <algebra>$function</algebra> with respect to the
! 25: scalar product
! 26: <m>\[<g \mid h> =
! 27: \frac{1}{\pi} \int_{-\pi}^{\pi}dx g(x) \cdot h(x)\]</m>
! 28: </li>
! 29: <li>whose norm is 1.</li>
! 30: </ol><endouttext />
! 31: <mathresponse answerdisplay="$example" cas="maxima" args="$function">
! 32: <answer>overlap:integrate((RESPONSE[1])*(LONCAPALIST[1]),x,-%pi,%pi)/%pi;
! 33: norm:integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
! 34: is(overlap=0 and norm=1);</answer>
! 35: <textline readonly="no" size="50" />
! 36: <hintgroup showoncorrect="no">
! 37: <mathhint name="ortho" args="$function" cas="maxima">
! 38: <answer>overlap: integrate((LONCAPALIST[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
! 39: is(not overlap = 0);</answer>
! 40: </mathhint>
! 41: <mathhint name="norm" args="$function" cas="maxima">
! 42: <answer>norm: integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
! 43: is(not norm = 1);</answer>
! 44: </mathhint> <hintpart on="norm">
! 45: <startouttext />
! 46: The function you have provided does not have a norm of one.<endouttext />
! 47: </hintpart>
! 48: <hintpart on="ortho">
! 49: <startouttext />
! 50: The function you have provided is not orthogonal.<endouttext />
! 51: </hintpart>
! 52: </hintgroup>
! 53: </mathresponse>
! 54: <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 />
! 55: </postanswerdate>
! 56: </problem>
! 57: \end{verbatim}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>