File:  [LON-CAPA] / loncom / homework / templates / HintMathResponse.problem
Revision 1.4: download - view: text, annotated - select for diffs
Mon Jul 6 17:12:47 2009 UTC (15 years ago) by bisitz
Branches: MAIN
CVS tags: version_2_9_99_0, bz6209-base, bz6209, bz2851, PRINT_INCOMPLETE_base, PRINT_INCOMPLETE, HEAD, GCI_3
Consistent problem templates:
- New line after each tag (not for texts in foils)
- One empty row after each end tag and before new start tag for second level tags
- No indentation for second level tags, e.g. <script>
- Four white spaces as indentation for each further sub level
    Exceptions:
        -Content (mostly text) in separate line(s): no indentation
        - Concept groups: same indentation as foilgroup
          (allows to insert code from problems without concept groups without changing the indentation and vice versa)
- No new line at end of template
- Removed new lines from within the middle of default texts
- Added one blank each after "<m>$" and before "$</m>" to ensure no misinterpretation neither by human nor by machine (e.g. "<m>$x" is not "<m>$ $x")
- Replaced deprecated font tag in <instructorcomment> by CSS
- Removed dos line endings
- dos2unix conversion
  (ClickImageExample.problem, RandomLabelExample.problem, SimpleMatching.problem)

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

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