File:  [LON-CAPA] / loncom / homework / templates / HintMathResponse.problem
Revision 1.5: download - view: text, annotated - select for diffs
Fri Jun 11 19:50:12 2010 UTC (14 years ago) by www
Branches: MAIN
CVS tags: version_2_12_X, version_2_11_X, version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4, version_2_11_3_uiuc, version_2_11_3_msu, version_2_11_3, version_2_11_2_uiuc, version_2_11_2_msu, version_2_11_2_educog, version_2_11_2, version_2_11_1, version_2_11_0_RC3, version_2_11_0_RC2, version_2_11_0_RC1, version_2_11_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, HEAD, BZ4492-merge, BZ4492-feature_horizontal_radioresponse, BZ4492-feature_Support_horizontal_radioresponse, BZ4492-Support_horizontal_radioresponse
New templates
Cleaner mathresponse template

    1: <problem>
    2: 
    3: <script type="loncapa/perl">
    4: $a1 = &random(-6,6,4);
    5: $a2 = &random(-6,6,4);
    6: $n1 = &random(3,11,2);
    7: $n2 = &random(2,10,2);
    8: $function = "$a1*cos($n1*x)+$a2*sin($n2*x)";
    9: $example=&xmlparse('An example would be <m eval="on">$ (sin($n1\cdot x)+cos($n2\cdot x))/\sqrt{2} $</m>');
   10: </script>
   11: 
   12: <startouttext />
   13: Give an example of a function
   14: <ol>
   15:     <li>which is orthogonal to<br />
   16: <center> <algebra>$function</algebra></center>
   17: <br />
   18:  with respect to the scalar product
   19:         <m>\[<g \mid h> = \frac{1}{\pi} \int_{-\pi}^{\pi}dx g(x) \cdot h(x)\]</m>
   20:     </li>
   21:     <li>whose norm is 1.</li>
   22: </ol>
   23: <endouttext />
   24: 
   25: <mathresponse answerdisplay="$example" cas="maxima" args="$function">
   26:     <answer>
   27: overlap:integrate((RESPONSE[1])*(LONCAPALIST[1]),x,-%pi,%pi)/%pi;
   28: norm:integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
   29: is(overlap=0 and norm=1);
   30:     </answer>
   31: 
   32:     <textline readonly="no" size="50" />
   33: 
   34:     <hintgroup showoncorrect="no">
   35:         <mathhint name="ortho" args="$function" cas="maxima">
   36:             <answer>
   37: overlap: integrate((LONCAPALIST[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
   38: is(not overlap = 0);
   39:             </answer>
   40:         </mathhint>
   41: 
   42:         <mathhint name="norm" args="$function" cas="maxima">
   43:             <answer>
   44: norm: integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
   45: is(not norm = 1);
   46:             </answer>
   47:         </mathhint>
   48:            
   49:         <hintpart on="norm">
   50:             <startouttext />
   51: The function you have provided does not have a norm of one.
   52:             <endouttext />
   53:         </hintpart>
   54: 
   55:         <hintpart on="ortho">
   56:             <startouttext />
   57: The function you have provided is not orthogonal.
   58:             <endouttext />
   59:         </hintpart>
   60: 
   61:     </hintgroup>
   62: </mathresponse>
   63: 
   64: <postanswerdate>
   65:     <startouttext />
   66: <p>
   67: 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>.
   68: </p>
   69:     <endouttext />
   70: </postanswerdate>
   71: 
   72: </problem>

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