File:  [LON-CAPA] / loncom / homework / mathresponse.idea
Revision 1.1: download - view: text, annotated - select for diffs
Wed Jun 14 18:31:37 2006 UTC (17 years, 10 months ago) by albertel
Branches: MAIN
CVS tags: version_2_2_X, version_2_2_2, version_2_2_1, version_2_2_0, version_2_1_X, version_2_1_99_3, version_2_1_99_2, version_2_1_99_1, version_2_1_99_0, HEAD
- adding some design docs

<problem>

<script type="loncapa/perl">
$a1 = random(-5,5,2);
$a2 = random(-5,5,2);
$n1 = random(1,10,1);
$n2 = random(1,10,1);
$function = "$a1*cos($n1*x)+$a2*sin($n2*x)";
@cas_list = ($function);
</script>

<startouttext />
Give an example of a function which is
(1) orthogonal to <algebra>$function</algebra> with respect to the
scalar product
<m>$$\langle g \mid h \rangle =
\frac{1}{\pi} \int_{-\pi}^{\pi} g(x) \cdot h(x)$$</m>
and
(2) whose norm is 1.
<endouttext />

<mathresponse cas="maxima" args="@cas_list">
   <answer>
     f(x):= LONCAPALIST[1];
     overlap: integrate(f(x)*RESPONSE[1],x,-%pi,%pi)/%pi;
     norm: integrate(RESPONSE[1]*RESPONSE[1],x,-%pi,%pi)/%pi;
     grade: is(overlap=0 and norm=1);
     [grade];
   </answer>

   <textline />

   <hintgroup showoncorrect="no">
     <mathhint cas="maxima" args="@cas_list" name="ortho">
       <answer>
         f(x):= LONCAPALIST[1];
         overlap: integrate(f(x)*RESPONSE[1],x,-%pi,%pi)/%pi;
	 [is(overlap != 0)];
       </answer>
     </mathhint>
     <mathhint cas="maxima" args="@cas_list" name="norm">
       <answer>
         f(x):= LONCAPALIST[1];
         norm: integrate(RESPONSE[1]*RESPONSE[1],x,-%pi,%pi)/%pi;
         [is(norm != 1)];
       </answer>
     </mathhint>


     <hintpart on="norm">
       <script type="loncapa/perl">
         $response = &EXT('user.resource.resource.0.submissiom');
	 $norm = &cas('maxima',...); # get the norm
	 $norm_display = &cas_tex_display($norm);
       </script>
       <startouttext />
         The function you have provided is not normal to
         <algebra>$function</algebra> its norm is
          <m eval="on">$norm_display</m>
       <endouttext />
     </hintpart>
     <hintpart on="ortho">
       <startouttext />
         The function you have provided is not orthognal.
       <endouttext />
     </hintpart>

   </hintgroup>
</mathresponse>

</problem>

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