--- loncom/homework/templates/SimpleFormula.problem 2004/06/10 22:17:59 1.3 +++ loncom/homework/templates/SimpleFormula.problem 2005/01/31 11:17:04 1.5 @@ -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 decription="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> +