Annotation of loncom/homework/templates/HintMathResponse.problem, revision 1.2

1.2     ! albertel    1: <problem>
        !             2:     <script type="loncapa/perl">
1.1       www         3: $a1 = random(-6,6,4);
                      4: $a2 = random(-6,6,4);
                      5: $n1 = random(3,11,2);
                      6: $n2 = random(2,10,2);
                      7: $function = "$a1*cos($n1*x)+$a2*sin($n2*x)";
1.2     ! albertel    8: $example=&xmlparse('An example would be <m eval="on">$(sin($n1\cdot x)+cos($n2\cdot x))/\sqrt{2}$</m>');
        !             9:     </script>
        !            10: 
        !            11:     <startouttext />
1.1       www        12: Give an example of a function
                     13: <ol>
1.2     ! albertel   14:     <li>which is orthogonal to <algebra>$function</algebra> with respect to the
        !            15:         scalar product
        !            16:         <m>\[<g \mid h> = \frac{1}{\pi} \int_{-\pi}^{\pi}dx g(x) \cdot h(x)\]</m>
        !            17:     </li>
        !            18:     <li>whose norm is 1.</li>
        !            19: </ol>
        !            20:     <endouttext />
        !            21: 
        !            22:     <mathresponse answerdisplay="$example" cas="maxima" args="$function">
        !            23: 
        !            24:         <answer>
        !            25: overlap:integrate((RESPONSE[1])*(LONCAPALIST[1]),x,-%pi,%pi)/%pi;
1.1       www        26: norm:integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
1.2     ! albertel   27: is(overlap=0 and norm=1);
        !            28:         </answer>
        !            29: 
        !            30:         <textline readonly="no" size="50" />
        !            31: 
        !            32:         <hintgroup showoncorrect="no">
        !            33: 
        !            34:             <mathhint name="ortho" args="$function" cas="maxima">
        !            35: 
        !            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: 
        !            66:         <startouttext />
        !            67: <p>
        !            68:     Note that with respect to the above norm, <m>$\cos(nx)$</m> is
        !            69:     perpendicular to <m>$\sin(nx)$</m> and perpendicular to <m>$\cos(mx)$</m>
        !            70:     for <m>$n\ne m$</m>.
        !            71: </p>
        !            72:         <endouttext />
        !            73: 
        !            74:     </postanswerdate>
1.1       www        75: </problem>

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