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

www lon-capa-cvs@mail.lon-capa.org
Mon, 31 Jan 2005 11:17:04 -0000


www		Mon Jan 31 06:17:04 2005 EDT

  Modified files:              
    /loncom/homework/templates	SimpleFormula.problem 
  Log:
  Bug #2726: previous example not very helpful in writing your own
  
  
Index: loncom/homework/templates/SimpleFormula.problem
diff -u loncom/homework/templates/SimpleFormula.problem:1.4 loncom/homework/templates/SimpleFormula.problem:1.5
--- loncom/homework/templates/SimpleFormula.problem:1.4	Thu Aug 19 16:29:22 2004
+++ loncom/homework/templates/SimpleFormula.problem	Mon Jan 31 06:17:04 2005
@@ -1,20 +1,15 @@
-<problem>
-<script type="loncapa/perl">$z=&random(1,10,1);
-$constant=&random(1,10,1);
-# y=x+z-constant, solving for x, x=y-z+constant, prettyconstant is for simplifying
-$prettyconstant=$constant-$z;
-$x="y+$prettyconstant";
-# code below substitutes '+-' and '-+' for '-'.  This is used in display of answer
-$x=~s/\+-/-/g;
-$x=~s/-\+/-/g;</script>
-
-<startouttext />If z=$z and y=x+z-$constant, what does x equal?  
-<endouttext />
-
-<formularesponse samples="y@-5:5#10" answer="$x">
-    <responseparam description="Numerical Tolerance" type="tolerance" default="0.00001" name="tol" />
-    <textline size="25" />    
-</formularesponse>
-
-</problem>
-
+<problem>
+<script type="loncapa/perl">$k=&random(3,6,1);
+$formula="a*x^$k";
+$m=$k-1;
+$derivative="$k*a*x^$m";</script>
+
+<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>
+
+</problem>
+