Annotation of loncom/homework/mathresponse.idea, revision 1.1

1.1     ! albertel    1: <problem>
        !             2: 
        !             3: <script type="loncapa/perl">
        !             4: $a1 = random(-5,5,2);
        !             5: $a2 = random(-5,5,2);
        !             6: $n1 = random(1,10,1);
        !             7: $n2 = random(1,10,1);
        !             8: $function = "$a1*cos($n1*x)+$a2*sin($n2*x)";
        !             9: @cas_list = ($function);
        !            10: </script>
        !            11: 
        !            12: <startouttext />
        !            13: Give an example of a function which is
        !            14: (1) orthogonal to <algebra>$function</algebra> with respect to the
        !            15: scalar product
        !            16: <m>$$\langle g \mid h \rangle =
        !            17: \frac{1}{\pi} \int_{-\pi}^{\pi} g(x) \cdot h(x)$$</m>
        !            18: and
        !            19: (2) whose norm is 1.
        !            20: <endouttext />
        !            21: 
        !            22: <mathresponse cas="maxima" args="@cas_list">
        !            23:    <answer>
        !            24:      f(x):= LONCAPALIST[1];
        !            25:      overlap: integrate(f(x)*RESPONSE[1],x,-%pi,%pi)/%pi;
        !            26:      norm: integrate(RESPONSE[1]*RESPONSE[1],x,-%pi,%pi)/%pi;
        !            27:      grade: is(overlap=0 and norm=1);
        !            28:      [grade];
        !            29:    </answer>
        !            30: 
        !            31:    <textline />
        !            32: 
        !            33:    <hintgroup showoncorrect="no">
        !            34:      <mathhint cas="maxima" args="@cas_list" name="ortho">
        !            35:        <answer>
        !            36:          f(x):= LONCAPALIST[1];
        !            37:          overlap: integrate(f(x)*RESPONSE[1],x,-%pi,%pi)/%pi;
        !            38: 	 [is(overlap != 0)];
        !            39:        </answer>
        !            40:      </mathhint>
        !            41:      <mathhint cas="maxima" args="@cas_list" name="norm">
        !            42:        <answer>
        !            43:          f(x):= LONCAPALIST[1];
        !            44:          norm: integrate(RESPONSE[1]*RESPONSE[1],x,-%pi,%pi)/%pi;
        !            45:          [is(norm != 1)];
        !            46:        </answer>
        !            47:      </mathhint>
        !            48: 
        !            49: 
        !            50:      <hintpart on="norm">
        !            51:        <script type="loncapa/perl">
        !            52:          $response = &EXT('user.resource.resource.0.submissiom');
        !            53: 	 $norm = &cas('maxima',...); # get the norm
        !            54: 	 $norm_display = &cas_tex_display($norm);
        !            55:        </script>
        !            56:        <startouttext />
        !            57:          The function you have provided is not normal to
        !            58:          <algebra>$function</algebra> its norm is
        !            59:           <m eval="on">$norm_display</m>
        !            60:        <endouttext />
        !            61:      </hintpart>
        !            62:      <hintpart on="ortho">
        !            63:        <startouttext />
        !            64:          The function you have provided is not orthognal.
        !            65:        <endouttext />
        !            66:      </hintpart>
        !            67: 
        !            68:    </hintgroup>
        !            69: </mathresponse>
        !            70: 
        !            71: </problem>

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