[LON-CAPA-cvs] cvs: loncom /homework/templates HintMathResponse.problem answerdependent.problem answerdependent.problem.meta doc/loncapafiles loncapafiles.lpml
www
www@source.lon-capa.org
Fri, 11 Jun 2010 19:50:12 -0000
www Fri Jun 11 19:50:12 2010 EDT
Added files:
/loncom/homework/templates answerdependent.problem
answerdependent.problem.meta
Modified files:
/doc/loncapafiles loncapafiles.lpml
/loncom/homework/templates HintMathResponse.problem
Log:
New templates
Cleaner mathresponse template
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.688 doc/loncapafiles/loncapafiles.lpml:1.689
--- doc/loncapafiles/loncapafiles.lpml:1.688 Tue Jun 1 03:21:49 2010
+++ doc/loncapafiles/loncapafiles.lpml Fri Jun 11 19:50:08 2010
@@ -2,7 +2,7 @@
"http://lpml.sourceforge.net/DTD/lpml.dtd">
<!-- loncapafiles.lpml -->
-<!-- $Id: loncapafiles.lpml,v 1.688 2010/06/01 03:21:49 raeburn Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.689 2010/06/11 19:50:08 www Exp $ -->
<!--
@@ -1278,6 +1278,8 @@
Template files for generating new resources.
</description>
<filenames>
+answerdependent.problem;
+answerdependent.problem.meta;
blank.library;
blank.library.meta;
blank.problem;
Index: loncom/homework/templates/HintMathResponse.problem
diff -u loncom/homework/templates/HintMathResponse.problem:1.4 loncom/homework/templates/HintMathResponse.problem:1.5
--- loncom/homework/templates/HintMathResponse.problem:1.4 Mon Jul 6 17:12:47 2009
+++ loncom/homework/templates/HintMathResponse.problem Fri Jun 11 19:50:12 2010
@@ -12,7 +12,10 @@
<startouttext />
Give an example of a function
<ol>
- <li>which is orthogonal to <algebra>$function</algebra> with respect to the scalar product
+ <li>which is orthogonal to<br />
+<center> <algebra>$function</algebra></center>
+<br />
+ 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>
Index: loncom/homework/templates/answerdependent.problem
+++ loncom/homework/templates/answerdependent.problem
<problem>
<parameter name="ordered" type="string_yesno" description="Show Parts One-at-a-Time" default="yes" />
<script type="loncapa/perl">
$lower=&random(3,10,1);
$higher=&random(15,20,1);
$answer=&random($lower,$higher,0.1);
$example='An example would be '.$answer;
# Get the entered answer. First argument is partID, second is responseID
$given=&submission(1,11);
if ($given=~/\d/) { $answer=$given; $example='You chose '.$given; }
$add=&random(3,6,0.1);
$result=$given+$add;
</script>
<part id="1">
<startouttext />
Give a number between $lower and $higher.
<endouttext />
<customresponse answerdisplay="$example" id="11">
<answer type="loncapa/perl"># We do not want a vector
if ($submission=~/\,/) { return 'EXTRA_ANSWER'; }
# No units needed
if ($submission=~/^\d+\s+\w+$/) { return 'UNIT_NOTNEEDED'; }
# Need a numerical answer here
if ($submission!~/^[\d\.]+$/) { return 'WANTED_NUMERIC'; }
# is it correct?
if (($submission>=$lower) && ($submission<=$higher)) { return 'EXACT_ANS'; }
return 'INCORRECT';</answer>
<textline readonly="no" />
</customresponse>
</part>
<part id="2">
<startouttext />
What do you get if you add $add to your number?
<endouttext />
<numericalresponse answer="$result">
<responseparam type="tolerance" default="1%" name="tol" description="Numerical Tolerance" />
<textline readonly="no" />
</numericalresponse>
</part>
</problem>
Index: loncom/homework/templates/answerdependent.problem.meta
+++ loncom/homework/templates/answerdependent.problem.meta
<title>Using Learner Answer in Numerical Problem</title>
<category>Input-Dependent Multipart Problems</category>
<help></help>