[system] Repository:
ViewVC logotype

Revision 3715


Jump to revision: Previous Next
Author: dpvc
Date: Sun Oct 16 03:27:35 2005 UTC (14 years, 1 month ago)
Log Message:
Added a new experimental diagonstic function for the function answer
checker.  When enabled, it will produce graphs of the correct answer,
the student answer, and the absolute and relative errors, and will
list the data points used in the comparison, plus the numerical values
of the results and errors.

To enable the diagnostic, use

   ANS(fun_cmp($f,diagnostics=>1));

Note that only single-variable functions can be graphed at the moment,
so if you are using a multi-variable check, you need to disable the
graphing.  To do this use

   ANS(fun_cmp($f,vars=>['x','y'],diagnostics=>[showGraphs=>0]));

The diagnostic mode is only available for the Parser-based versions of
the function checker, and (of course) with the native Parser objects
as well:

   ANS(Formula($f)->cmp(diagnostics=>1));

There are now Context settings to control the diagnostics, which can
be set through Context()->diagnostics->set().  For example

   Context()->diagnostics->set(formulas=>{showGraphs=>0});

would turn off graphs for all functions comparisons.  Some of the
other values you can set are:

   formulas => {
     showTestPoints => 1,        # show the test points and function values
     showRelativeErrors => 1,    # show the relative errors for the student answer
     showAbsoluteErrors => 1,    # show the absolute errors for the student answer
     showGraphs => 1,            # show the various graphs
     graphRelativeErrors => 1,   #  show the relative error graph
     graphAbsoluteErrors => 1,   #  show the absolute error graph
     clipRelativeError => 5,     #  don't show relative errors above 5
     clipAbsoluteError => 5,     #  don't show absolute errors above 5
     plotTestPoints => 1,        #  include dots at the test points
     combineGraphs => 1,         #  show correct and student graphs in one image
   },
   graphs => {
     divisions => 75,       # the number of data points to plot
     limits => [-2,2],      # the lower and upper limit of the plot
                            #  (taken from the function limits if not provided)
     size => 250,           # pixel size of the image (could be [width,height])
     grid => [10,10],       # number of grid lines in each direction
     axes => [0,0],         # where to put axes relative to origin
   }

Any of these can be set in the Context(), or in the answer checker
itself.  If you set diagnostics to an array reference, the entries in
the array refer to element of the formulas hash.  If you set
diagonstics to a hash reference, then you can set values in either the
formulas or graphs hashes, as in:

   ANS(Formula($f)->cmp(diagnostics=>{
     formulas => {showAbsoluteErrors=>0},
     graphs => {size=>300, divisions=>100},
   }));

If you want all function checkers to show diagnostics, use

   Context()->diagonstics->set(formulas=>{show=>1});

The image file names are modified to include the current time so that
the names will be unique.  This avoids problems with the browser cache
showing a old image when a new one has been generated.  But this also
means that the temporary image directory will fill up fast, so you may
need to empty it if you use the diagnostic images frequently.

This is just a first attempt at a diagnostic feature.  I think it will
help when you are not sure if the tolerances are set properly, or if
you think a student answer should be markes correct but isn't, as it
will point out which point(s) are not being accepted.

Changed paths:

Path Details
Directorytrunk/pg/lib/Value/AnswerChecker.pm modified , text changed
Directorytrunk/pg/macros/PGanswermacros.pl modified , text changed

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9