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

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.5     ! www        15:     <li>which is orthogonal to<br />
        !            16: <center> <algebra>$function</algebra></center>
        !            17: <br />
        !            18:  with respect to the scalar product
1.2       albertel   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>
1.4       bisitz     23: <endouttext />
1.2       albertel   24: 
1.4       bisitz     25: <mathresponse answerdisplay="$example" cas="maxima" args="$function">
                     26:     <answer>
1.2       albertel   27: overlap:integrate((RESPONSE[1])*(LONCAPALIST[1]),x,-%pi,%pi)/%pi;
1.1       www        28: norm:integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
1.2       albertel   29: is(overlap=0 and norm=1);
1.4       bisitz     30:     </answer>
1.2       albertel   31: 
1.4       bisitz     32:     <textline readonly="no" size="50" />
1.2       albertel   33: 
1.4       bisitz     34:     <hintgroup showoncorrect="no">
                     35:         <mathhint name="ortho" args="$function" cas="maxima">
                     36:             <answer>
1.2       albertel   37: overlap: integrate((LONCAPALIST[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
                     38: is(not overlap = 0);
1.4       bisitz     39:             </answer>
                     40:         </mathhint>
1.2       albertel   41: 
1.4       bisitz     42:         <mathhint name="norm" args="$function" cas="maxima">
                     43:             <answer>
1.2       albertel   44: norm: integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
                     45: is(not norm = 1);
1.4       bisitz     46:             </answer>
                     47:         </mathhint>
1.2       albertel   48:            
1.4       bisitz     49:         <hintpart on="norm">
                     50:             <startouttext />
1.2       albertel   51: The function you have provided does not have a norm of one.
1.4       bisitz     52:             <endouttext />
                     53:         </hintpart>
1.2       albertel   54: 
1.4       bisitz     55:         <hintpart on="ortho">
                     56:             <startouttext />
1.2       albertel   57: The function you have provided is not orthogonal.
1.4       bisitz     58:             <endouttext />
                     59:         </hintpart>
1.2       albertel   60: 
1.4       bisitz     61:     </hintgroup>
                     62: </mathresponse>
1.2       albertel   63: 
1.4       bisitz     64: <postanswerdate>
                     65:     <startouttext />
1.2       albertel   66: <p>
1.4       bisitz     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>.
1.2       albertel   68: </p>
1.4       bisitz     69:     <endouttext />
                     70: </postanswerdate>
1.2       albertel   71: 
1.1       www        72: </problem>

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