Log of /trunk/pg/lib/Value.pm
Parent Directory
Revision
2669 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Aug 22 15:42:50 2004 UTC (8 years, 8 months ago) by
dpvc
File length: 14534 byte(s)
Diff to
previous 2664
Made the granularity of the test-point intervals be a parameter that
can be set on a global or variable-by-variable basis, so this is now
controlable from the .pg file. For example:
Context("Numeric")->variables->are(
k=>{limits=>[1,10], resolution=>1},
x=>{limits=>[-2,2], granularity=>1000},
);
will make k be a variable that will only take on integer values
between 1 and 10, and x a variable that will take on one of 1000
different values evenly spaced between -2 and 2 (so resolution is
4/1000 in this case).
These parameters can also be set for an individual formula:
$f = Formula("k^2-1");
$f->{resolution} = 1;
$f->{limits} = [0,10];
Revision
2664 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 21 22:02:14 2004 UTC (8 years, 8 months ago) by
dpvc
File length: 14475 byte(s)
Diff to
previous 2660
Added a file to perform WeBWorK-specific modifications to the
Parser/Value packages. (I've tried to make these independent of
WeBWorK, so you can use them in other perl code if you want to.)
The parameters for fuzzy reals and some of the other parameters now
are taken from the pg->{ansEvalDefaults} values (as defined in
global.conf or course.conf). More still needs to be done with this,
however.
Revision
2660 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Aug 20 15:52:32 2004 UTC (8 years, 8 months ago) by
dpvc
File length: 14470 byte(s)
Diff to
previous 2654
A number of adjustments to get negative infinities to work better.
They used to be stored as separate Parser strings, but now they are
flagged versions of a single string.
All of the problems are really due to the fact that there is no
Infinity class in the Parser (only a Value version). That should be
changed, but will require some work, and can be put off for now.
It would be best if the classes within the two packages would match up
nearly 1-to-1, but for historical reasons, they don't. Since the
introduction of Real, String and Infinity classes to the Value
package, The Infinity class is the one main difference between the
two, and once that is fixed, everything needs to be looked over to
check for unnecessary complications due to the historical lack of classes
in one or the other package.
Revision
2646 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Aug 19 12:16:41 2004 UTC (8 years, 9 months ago) by
dpvc
File length: 14200 byte(s)
Diff to
previous 2629
Make it possible to create subclasses of objects in the value package
that are not actually in the Value:: package tree. This makes it
possible to have .pl files (that are run via loadMacros) that create
new Value object classes that are local to the problem rather than
global to the system. (With mod_perl, if a .pl file added to the
Value:: tree itself, the results would be persistent, and this could
adversely affect future problems processed by the same httpd child
process. It could lead to "redefined subroutine" errors, or worse.)
This provides a safe way to extend the parser on a problem-specific
basis.
This technique is used in the line and plane answer checkers (coming
soon), for example. If such a checker becomes widely used, it can
always be added into the Value:: tree at a later time.
Revision
2629 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Aug 17 02:01:27 2004 UTC (8 years, 9 months ago) by
dpvc
File length: 14033 byte(s)
Diff to
previous 2628
Fixed a number of minor problems with creating perl functions from
formulas (this is done automatically as part of the function answer
checker, so is showing up now that I have that checker in place).
Also improved error messages in the function answer checker, and fixed
a bug when students enter a constant list or union when the answer
checker expects formulas.
Revision
2628 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Aug 16 21:41:05 2004 UTC (8 years, 9 months ago) by
dpvc
File length: 13974 byte(s)
Diff to
previous 2625
Allow parser "constants" to be (in reality) formulas. That way, for
example, you can defined T, N and B to be the formulas for the unit
tangent, normal and binormal of a space curve (as functions of "t")
and the student can write anwers in terms of T, N and B (without
having to compute them).
You could have created FUNCTIONS T(t), N(t) and B(t), and added them
to the parser to get almost the same effect, but the students would
have had to include the "(t)". (If you want that, go ahead and do it
that way.)
Revision
2625 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Aug 16 18:35:12 2004 UTC (8 years, 9 months ago) by
dpvc
File length: 13964 byte(s)
Diff to
previous 2624
Added string comparison to all Value object classes (to compare the
string value of an object to another string).
Overloaded perl '.' operator to do dot product when the operands are
formulas returning vectors. (Part of the auto-generation of
formulas).
A few improvements to real and complex class output results.
Made Union class slightly more robust and removed need for makeUnion
method other than in the Union itself.
Revision
2624 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Aug 16 13:44:45 2004 UTC (8 years, 9 months ago) by
dpvc
File length: 13673 byte(s)
Diff to
previous 2622
Added support for unorderd list or formulas with partial credit.
Fixed type mismatch reporting in formula answer checker.
Fixed an error with Unions producing incorrect perl versions under
some circumstances.
Revision
2622 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Aug 15 22:46:57 2004 UTC (8 years, 9 months ago) by
dpvc
File length: 13715 byte(s)
Diff to
previous 2621
Created the first draft of the Parser's function answer checker. Some
work still needs to be done, in particular, type mismatches are not
being reported, and lists are being processed only as ordered lists
with no partial credit.
This doesn't implement everything from fun_cmp. In particular, there
is no support for parameter matching at the moment. This will have to
be added, but I'm not quite sure how to do it when the function's
return value is not a real number (e.g., an interval).
On the other hand, this checker is more forgiving about domain errors:
if tries a point where the professor's function is not defined, it
ignores that one and looks for another (until it decides it can't find
one). Once it has these points, it tries them on the student's
answer, and if the student's function is undefined, then the student
answer is wrong (since it is not defined somewhere that the
professor's funciton is). This avoids the "Error evaluating student
function at ..." messages, which just confused most students anyway.
Revision
2621 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Aug 15 17:05:41 2004 UTC (8 years, 9 months ago) by
dpvc
File length: 13639 byte(s)
Diff to
previous 2612
Improved error messages, particularly when the student enters a
formula in an answer that should be constant, and also for incorrect
answers in lists of answers. There are a few other miscellaneous output
improvements as well.
Revision
2609 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 14 13:54:52 2004 UTC (8 years, 9 months ago) by
dpvc
File length: 13331 byte(s)
Diff to
previous 2606
Added a String type to the Value package. Mostly this is to make it
possible to generate an answer checker for it that uses the parser.
It also makes it more consistent for handling things like stringify,
especially when they are recursively called internally.
Added new default strings "NONE" and "DNE", since these get used a
lot.
Modified how the default parameters are set up for the answer
checkers, and how the answer checker reports the expected answer type
in type mismatch error messages.
Revision
2606 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 14 11:25:47 2004 UTC (8 years, 9 months ago) by
dpvc
File length: 13100 byte(s)
Diff to
previous 2605
Can now specify that the objects stringify themselfs in their TeX
forms rather than their answer-string forms. This makes it easier to
use the objects in the text of a problem (without having to call ->TeX
explicitly each reference).
Use
Context()->texStrings
to start outputting TeX strings, and
Context()->normalStrings
to switch back.
Revision
2605 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 14 02:50:18 2004 UTC (8 years, 9 months ago) by
dpvc
File length: 12896 byte(s)
Diff to
previous 2604
Incorporated infinities into Parser package better. They have been
stored as String objects (with extra data) in the parser, and I've
left it that way, but now they convert to/from Vallue::Infinity
objects correctly, and these are used for generating the output.
Also added the Infinity answer checker, and adjusted the error
messages produces by type mismatches in the answer checkers and
elsewhere.
Revision
2601 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Aug 13 19:06:09 2004 UTC (8 years, 9 months ago) by
dpvc
File length: 12409 byte(s)
Diff to
previous 2596
Added ability to report incorrect coordinates in point and vector
answers, and incorrect endpoints and endpoint types in intervals.
Separated these kinds of checks from the typeMatch check, where they
didn't really belong.
Added ability to specify intervals and unions as strings in Interval()
and Union(), which makes it easier to make constants of these types.
There are still problems comparing intervals that contain infinities;
I really need to make the infinity object to solve this, so have put
off trying to fix that for now.
Revision
2592 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Aug 12 16:40:47 2004 UTC (8 years, 9 months ago) by
dpvc
File length: 12055 byte(s)
Diff to
previous 2579
A number of small fixes. Most were to fix minor bugs in string and
TeX output, particulary for the various list-based objects (like
vectors, intervals, etc.). There were also some bug fixes in the
comparison routines. Some additional checks were added for valid
intervals when the coordinates are formulas.
Revision
2579 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Aug 9 21:38:01 2004 UTC (8 years, 9 months ago) by
dpvc
File length: 11668 byte(s)
Diff to
previous 2576
Significant update to new parser.
New features include:
Better control over format of vector output (you can now
specify ijk-format rather than <...> format)
"Fuzzy" reals, where the relations like == return true when the
two values are "close enough". (This is controlable using
parameters similar to those used in NUM_CMP).
The fuzzy reals are now used in vectors/points/matrices/complexes/intervals
and so on so that their relations will also be fuzzy. E.g.,
(1E-13,2) == (0,3) will be true, and norm(Vector(0,1E-13)) will
equal 0.
The two main portions of the parser (the Parser and Value packages)
now share a common context object for configuration purposes.
This form allows you to request diffs between any two revisions of this file.
For each of the two "sides" of the diff,
enter a numeric revision.