[LON-CAPA-cvs] cvs: loncom /homework functionplotresponse.pm /html/adm/help/tex Function_Plot_Response_Evaluation_Rule.tex /xml lonxml.pm
www
www at source.lon-capa.org
Thu Oct 13 20:40:32 EDT 2011
www Fri Oct 14 00:40:32 2011 EDT
Modified files:
/loncom/homework functionplotresponse.pm
/loncom/html/adm/help/tex
Function_Plot_Response_Evaluation_Rule.tex
/loncom/xml lonxml.pm
Log:
Be able to access labels when defining values
Index: loncom/homework/functionplotresponse.pm
diff -u loncom/homework/functionplotresponse.pm:1.65 loncom/homework/functionplotresponse.pm:1.66
--- loncom/homework/functionplotresponse.pm:1.65 Thu Oct 13 01:54:12 2011
+++ loncom/homework/functionplotresponse.pm Fri Oct 14 00:40:24 2011
@@ -1,7 +1,7 @@
# LearningOnline Network with CAPA
# option list style responses
#
-# $Id: functionplotresponse.pm,v 1.65 2011/10/13 01:54:12 www Exp $
+# $Id: functionplotresponse.pm,v 1.66 2011/10/14 00:40:24 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -981,6 +981,13 @@
return $xmin+$i/400.*($xmax-$xmin);
}
+sub fpr_val {
+ my ($arg)=@_;
+ return &actualval($Apache::functionplotresponse::functionplotrulelabels{$arg},
+ $Apache::functionplotresponse::fpr_xmin,
+ $Apache::functionplotresponse::fpr_xmax);
+}
+
sub fpr_f {
my ($arg)=@_;
return $Apache::functionplotresponse::func[&array_index($Apache::functionplotresponse::fpr_xmin,
Index: loncom/html/adm/help/tex/Function_Plot_Response_Evaluation_Rule.tex
diff -u loncom/html/adm/help/tex/Function_Plot_Response_Evaluation_Rule.tex:1.2 loncom/html/adm/help/tex/Function_Plot_Response_Evaluation_Rule.tex:1.3
--- loncom/html/adm/help/tex/Function_Plot_Response_Evaluation_Rule.tex:1.2 Thu Oct 13 01:54:17 2011
+++ loncom/html/adm/help/tex/Function_Plot_Response_Evaluation_Rule.tex Fri Oct 14 00:40:28 2011
@@ -16,7 +16,7 @@
``Relationship'' - The heart of the rule. This choice determines whether the chosen 'Function' is greater than, less than, equal to, etc. a certain 'value'.
-``Value'' - See above. It is also possible to choose 'not defined', in the event the answer should not have a value for the given domain. Within the value argument, the function itself can be evaluated using \&fpr\_f(), its derivative using \&fpr\_dfdx, and its second derivative using \&fpr\_d2fdx2().
+``Value'' - See above. It is also possible to choose 'not defined', in the event the answer should not have a value for the given domain. Within the value argument, the function itself can be evaluated using \&fpr\_f(), its derivative using \&fpr\_dfdx(), and its second derivative using \&fpr\_d2fdx2(). The value of a previously defined label can be retrieved using the function \&fpr\_val(), e.g., \&fpr\_val('positive'). Previous defined values from script blocks can be retrieved as normal variables, e.g., \$x.
``Percent error'' - This allows for a margin of error in the y-direction. For instance, if the rule requires that the derivative be equal to 5, the server will accept values close enough to 5 that are within the percent error defined here. Note: Choosing 10\% would not mean that the answer is correct as long as it is within the range 4.5-5.5. Instead, the percent corresponds to the total size of the graph. For the function itself, the 'percent error' is multiplied by the ymax-ymin; for the first derivative, it's multiplied by (ymax-ymin)/(xmax-xmin); for the second derivative, it's multiplied by (ymax-ymin)/(xmax-xmin)^2; and for the integral, it's multiplied by (ymax-ymin)*(xmax-xmin).
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.520 loncom/xml/lonxml.pm:1.521
--- loncom/xml/lonxml.pm:1.520 Thu Oct 13 01:54:21 2011
+++ loncom/xml/lonxml.pm Fri Oct 14 00:40:32 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.520 2011/10/13 01:54:21 www Exp $
+# $Id: lonxml.pm,v 1.521 2011/10/14 00:40:32 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -788,6 +788,7 @@
$safehole->wrap(\&Apache::lonnet::logthis,$safeeval,'&LONCAPA_INTERNAL_LOGTHIS');
$safehole->wrap(\&Apache::inputtags::finalizeawards,$safeeval,'&LONCAPA_INTERNAL_FINALIZEAWARDS');
$safehole->wrap(\&Apache::caparesponse::get_sigrange,$safeeval,'&LONCAPA_INTERNAL_get_sigrange');
+ $safehole->wrap(\&Apache::functionplotresponse::fpr_val,$safeeval,'&fpr_val');
$safehole->wrap(\&Apache::functionplotresponse::fpr_f,$safeeval,'&fpr_f');
$safehole->wrap(\&Apache::functionplotresponse::fpr_dfdx,$safeeval,'&fpr_dfdx');
$safehole->wrap(\&Apache::functionplotresponse::fpr_d2fdx2,$safeeval,'&fpr_d2fdx2');
More information about the LON-CAPA-cvs
mailing list