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

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

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