[LON-CAPA-cvs] cvs: loncom /homework/templates HintFormula.problem HintMathResponse.problem SimpleFormula.problem SimpleFormulaCAS.problem

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 23 Jan 2007 21:16:50 -0000


This is a MIME encoded message

--albertel1169587010
Content-Type: text/plain

albertel		Tue Jan 23 16:16:50 2007 EDT

  Modified files:              
    /loncom/homework/templates	HintFormula.problem 
                              	HintMathResponse.problem 
                              	SimpleFormula.problem 
                              	SimpleFormulaCAS.problem 
  Log:
  - trying to make the problem code prettier
  - addin sample points to HintFormula.problem
  - remove tolerance specfication from CAS fomularesponse
  
  
--albertel1169587010
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20070123161650.txt"

Index: loncom/homework/templates/HintFormula.problem
diff -u loncom/homework/templates/HintFormula.problem:1.1 loncom/homework/templates/HintFormula.problem:1.2
--- loncom/homework/templates/HintFormula.problem:1.1	Mon Jan 22 16:48:55 2007
+++ loncom/homework/templates/HintFormula.problem	Tue Jan 23 16:16:50 2007
@@ -1,5 +1,5 @@
 <problem>
-<script type="loncapa/perl">
+    <script type="loncapa/perl">
 $a1=&random(3,6,1);
 $e1=&random(3,6,1);
 $a2=&random(6,8,1);
@@ -10,17 +10,19 @@
 $de2=$e2-1;
 @derivative=($da1.'t^'.$de1,$da2.'t^'.$de2);
 @wrongderivative=($a1.'t^'.$de1,$a2.'t^'.$de2);
-</script>
-<startouttext />What is the derivative of
+    </script>
+    <startouttext />
+What is the derivative of
 <m eval="on">\[\left(\begin{array}{c}$a1 t^$e1\\ $a2 t^$e2\end{array}\right)\]</m>
-with respect to <m>$t$</m>?<endouttext />
-<formularesponse answer="@derivative">
-<textline readonly="no" size="25" />
-<hintgroup showoncorrect="no">
-<formulahint answer="@wrongderivative" name="nomulti"></formulahint>
-<hintpart on="nomulti">
-<startouttext />You need to multiply with the original exponent.<endouttext />
-</hintpart>
-</hintgroup>
-</formularesponse>
+with respect to <m>$t$</m>?
+    <endouttext />
+    <formularesponse answer="@derivative" samples="t@-10:10#10">
+        <textline readonly="no" size="25" />
+        <hintgroup showoncorrect="no">
+            <formulahint answer="@wrongderivative" name="nomulti" samples="t@-10:10#10"></formulahint>
+            <hintpart on="nomulti">
+                <startouttext />You need to multiply with the original exponent.<endouttext />
+            </hintpart>
+        </hintgroup>
+    </formularesponse>
 </problem>
Index: loncom/homework/templates/HintMathResponse.problem
diff -u loncom/homework/templates/HintMathResponse.problem:1.1 loncom/homework/templates/HintMathResponse.problem:1.2
--- loncom/homework/templates/HintMathResponse.problem:1.1	Mon Jan 22 16:48:55 2007
+++ loncom/homework/templates/HintMathResponse.problem	Tue Jan 23 16:16:50 2007
@@ -1,44 +1,75 @@
- <problem>
-<script type="loncapa/perl">
+<problem>
+    <script type="loncapa/perl">
 $a1 = random(-6,6,4);
 $a2 = random(-6,6,4);
 $n1 = random(3,11,2);
 $n2 = random(2,10,2);
 $function = "$a1*cos($n1*x)+$a2*sin($n2*x)";
-$example=&xmlparse('An example would be <m eval="on">$(sin($n1\cdot x)+cos($n2\cdot x))/\sqrt{2}$</m>');</script>
-<startouttext />
+$example=&xmlparse('An example would be <m eval="on">$(sin($n1\cdot x)+cos($n2\cdot x))/\sqrt{2}$</m>');
+    </script>
+
+    <startouttext />
 Give an example of a function
 <ol>
-<li>which is orthogonal to <algebra>$function</algebra> with respect to the
-scalar product
-<m>\[<g \mid h> =
-\frac{1}{\pi} \int_{-\pi}^{\pi}dx g(x) \cdot h(x)\]</m>
-</li>
-<li>whose norm is 1.</li>
-</ol><endouttext />
-<mathresponse answerdisplay="$example" cas="maxima" args="$function">
-<answer>overlap:integrate((RESPONSE[1])*(LONCAPALIST[1]),x,-%pi,%pi)/%pi;
+    <li>which is orthogonal to <algebra>$function</algebra> with respect to the
+        scalar product
+        <m>\[<g \mid h> = \frac{1}{\pi} \int_{-\pi}^{\pi}dx g(x) \cdot h(x)\]</m>
+    </li>
+    <li>whose norm is 1.</li>
+</ol>
+    <endouttext />
+
+    <mathresponse answerdisplay="$example" cas="maxima" args="$function">
+
+        <answer>
+overlap:integrate((RESPONSE[1])*(LONCAPALIST[1]),x,-%pi,%pi)/%pi;
 norm:integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
-is(overlap=0 and norm=1);</answer>
-<textline readonly="no" size="50" />
-<hintgroup showoncorrect="no">
-<mathhint name="ortho" args="$function" cas="maxima">
-<answer>overlap: integrate((LONCAPALIST[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
-is(not overlap = 0);</answer>
-</mathhint>
-<mathhint name="norm" args="$function" cas="maxima">
-<answer>norm: integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
-is(not norm = 1);</answer>
-</mathhint> <hintpart on="norm">
-<startouttext />
-The function you have provided does not have a norm of one.<endouttext />
-</hintpart>
-<hintpart on="ortho">
-<startouttext />
-The function you have provided is not orthogonal.<endouttext />
-</hintpart>
-</hintgroup>
-</mathresponse>
-<postanswerdate><startouttext /><p>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>.</p><endouttext />
-</postanswerdate>
+is(overlap=0 and norm=1);
+        </answer>
+
+        <textline readonly="no" size="50" />
+
+        <hintgroup showoncorrect="no">
+
+            <mathhint name="ortho" args="$function" cas="maxima">
+
+                <answer>
+overlap: integrate((LONCAPALIST[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
+is(not overlap = 0);
+                </answer>
+            </mathhint>
+
+            <mathhint name="norm" args="$function" cas="maxima">
+                <answer>
+norm: integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi;
+is(not norm = 1);
+                </answer>
+            </mathhint>
+           
+            <hintpart on="norm">
+                <startouttext />
+The function you have provided does not have a norm of one.
+                <endouttext />
+            </hintpart>
+
+            <hintpart on="ortho">
+                <startouttext />
+The function you have provided is not orthogonal.
+                <endouttext />
+            </hintpart>
+
+        </hintgroup>
+    </mathresponse>
+
+    <postanswerdate>
+
+        <startouttext />
+<p>
+    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>.
+</p>
+        <endouttext />
+
+    </postanswerdate>
 </problem>
Index: loncom/homework/templates/SimpleFormula.problem
diff -u loncom/homework/templates/SimpleFormula.problem:1.5 loncom/homework/templates/SimpleFormula.problem:1.6
--- loncom/homework/templates/SimpleFormula.problem:1.5	Mon Jan 31 06:17:04 2005
+++ loncom/homework/templates/SimpleFormula.problem	Tue Jan 23 16:16:50 2007
@@ -1,15 +1,19 @@
 <problem>
-<script type="loncapa/perl">$k=&random(3,6,1);
+    <script type="loncapa/perl">
+$k=&random(3,6,1);
 $formula="a*x^$k";
 $m=$k-1;
-$derivative="$k*a*x^$m";</script>
+$derivative="$k*a*x^$m";
+    </script>
 
-<startouttext />What is the derivative of <tt>$formula</tt> with respect to x?<endouttext />
+    <startouttext />
+What is the derivative of <tt>$formula</tt> with respect to x?
+    <endouttext />
 
-<formularesponse samples="a,x@-3,-3:3,3#4" answer="$derivative">
-    <responseparam description="Numerical Tolerance" type="tolerance" default="0.00001" name="tol" />
-    <textline size="25" />    
-</formularesponse>
+    <formularesponse samples="a,x@-3,-3:3,3#4" answer="$derivative">
+        <responseparam description="Numerical Tolerance" type="tolerance" default="0.00001" name="tol" />
+        <textline size="25" />    
+    </formularesponse>
 
 </problem>
 
Index: loncom/homework/templates/SimpleFormulaCAS.problem
diff -u loncom/homework/templates/SimpleFormulaCAS.problem:1.1 loncom/homework/templates/SimpleFormulaCAS.problem:1.2
--- loncom/homework/templates/SimpleFormulaCAS.problem:1.1	Mon Jan 22 16:48:55 2007
+++ loncom/homework/templates/SimpleFormulaCAS.problem	Tue Jan 23 16:16:50 2007
@@ -1,15 +1,18 @@
 <problem>
-<script type="loncapa/perl">$k=&random(3,6,1);
+    <script type="loncapa/perl">
+$k=&random(3,6,1);
 $formula="a*x^$k";
 $m=$k-1;
-$derivative="$k*a*x^$m";</script>
+$derivative="$k*a*x^$m";
+    </script>
 
-<startouttext />What is the derivative of <tt>$formula</tt> with respect to x?<endouttext />
+    <startouttext />
+What is the derivative of <tt>$formula</tt> with respect to x?
+    <endouttext />
 
-<formularesponse answer="$derivative">
-    <responseparam description="Numerical Tolerance" type="tolerance" default="0.00001" name="tol" />
-    <textline size="25" />    
-</formularesponse>
+    <formularesponse answer="$derivative">
+        <textline size="25" />    
+    </formularesponse>
 
 </problem>
 

--albertel1169587010--