Log of /trunk/pg/lib/Parser/Value.pm
Parent Directory
Revision
5001 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Jun 12 04:05:56 2007 UTC (5 years, 11 months ago) by
dpvc
File length: 3608 byte(s)
Diff to
previous 4994
More fixes for creating items in the corret context. Also added a
method for looking up the package associated with a particular Parser
class (for consistency with the Value->Package call).
Revision
4994 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Jun 10 01:17:29 2007 UTC (5 years, 11 months ago) by
dpvc
File length: 3588 byte(s)
Diff to
previous 3523
Update to handle the fact that the Value package now includes the
context with all MathObjects. (This may still need some work.)
Revision
3523 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 13 22:38:39 2005 UTC (7 years, 9 months ago) by
dpvc
File length: 3494 byte(s)
Diff to
previous 3516
Added canBeInUnion and isSetOfReals methods to the Parser package
(similar to the ones in the Value package), replacing the
canBeInterval flag and other ad hoc checks.
Removed ability to form interval like [a] now that we have sets.
Revision
3516 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 13 20:59:28 2005 UTC (7 years, 9 months ago) by
dpvc
File length: 3601 byte(s)
Diff to
previous 3497
Added isSetOfReals and canBeInUnion methods to the Value objects, and
replaced the ad hoc tests for these conditions to call these
routines.
Cleaned up the make() methods for Intervals, Sets and Unions, and
improved the new() methods to handle more cases better.
Fixed Value::makeValue() to handle an array reference correctly.
I don't THINK any of this will break anything. :-)
Revision
3497 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 13 00:25:27 2005 UTC (7 years, 9 months ago) by
dpvc
File length: 3729 byte(s)
Diff to
previous 3466
Added ability for Unions and Sets to simplify themselves
(automatically or on demand), and added flags to the Context and
answer checkers to control these features. The new Context flags
are
reduceUnions tells whether unions are automatically
reduced when they are created.
reduceUnionsForComparison tells whether unions are reduced
before comparing them for equality
or inequality (etc) if they aren't
reduced already.
reduceSets tells whether redundent elements are
removed from sets as they are created.
reduceSetsForComparison tells whether sets are reduced before
comparing them.
All of these default to true.
The Interval, Set, Union, and List answer checkers not have two new
flags for controlling these values:
studentsMustReduceUnions tells whether unions and sets will be
counted as incorrect when they are not
reduced to non-overlapping intervals
and at most one set with no repeated
entries.
showUnionReduceWarnings tells whether an error message will
be produced for non-reduced unions and
sets, or if they will be marked wrong
silently. (Not available in Lists.)
Both of these are true by default, since most professors probably want
their students to write intervals in reduced form. (Is this true?)
This corresponds the the current behavior of the interval checkers,
which require the student's answer to be the same set of intervals as
in the professor's, but with the addition of an error message when the
student answer is not reduced.
Revision
3466 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Aug 11 14:19:26 2005 UTC (7 years, 9 months ago) by
dpvc
File length: 3409 byte(s)
Diff to
previous 3370
Added new Set object class to the Parser. It implements a finite set
of real numbers, for use with unions and intervals. E.g., (1,2) U {3}
or (1,2) U {3,4,5}. You can created Set objects in your perl code via
the Set() command, e.g, Set(3,4,5) or Set("{1,2,3}"). You should set
the Context to Context("Interval") if you plan to use Set objects, as
this defined the braces to form sets (rather than using them as
parentheses, which is the default WW behavior). Note that in Interval
context, you can NOT use braces as parentheses.
Current, Set objects are only allowed to be sets of numbers. It would
be possible to extend that in the future.
Revision
3370 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Jul 12 22:29:53 2005 UTC (7 years, 10 months ago) by
dpvc
File length: 3273 byte(s)
Diff to
previous 3369
A first pass at making parser error messages localizable. The
Context()->{error}{msg} hash can be used to specify translations of
the standard messages. For example,
Context()->{error}{msg}{'Division by zero'} = "Don't divide by zero, dude!";
Context()->{error}{msg}{'Function '%s' has too many inputs'} =
"You passed too many arguments to '%s'";
(I didn't translate into another language, here, but you could do
that, too.)
The msg hash could also be used within answer checkers to make certain
answer messages more appropriate for the given type of expected answer.
Revision
2800 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Sep 19 14:27:39 2004 UTC (8 years, 8 months ago) by
dpvc
File length: 3275 byte(s)
Diff to
previous 2684
Added isZero and isOne checks for Parser::Value objects (i.e., for
constants within formulas). These now correctly handle vector and
matrices, in particular. The isOne and isZero checks are used in the
reduce() method to simplify formulas.
Revision
2684 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Aug 24 21:35:21 2004 UTC (8 years, 8 months ago) by
dpvc
File length: 3399 byte(s)
Diff to
previous 2678
Added the makeUnion call that was removed earlier. The AnswerChecker
for formulas sometimes called it (when the student's answer is constant).
Revision
2678 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Aug 23 23:55:37 2004 UTC (8 years, 8 months ago) by
dpvc
File length: 3323 byte(s)
Diff to
previous 2660
Modified the parser so that the classes for the various object
constructors are stored in the context table rather than hard-coded
into the parser. That way, you can override the default classes with
your own. This gives you even more complete control to modify the
parser. (You had been able to replace the definitions of operators,
functions and list-like objects, but could not override the behaviour
of numbers, strings, variables, and so on. Now you can.)
This effects most of the files, but only by changing the name of the
calls that create the various objects.
There are also a couple of other minor fixes.
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: 3176 byte(s)
Diff to
previous 2626
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
2626 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Aug 16 19:44:26 2004 UTC (8 years, 9 months ago) by
dpvc
File length: 3090 byte(s)
Diff to
previous 2625
One more fix for handling intervals properly (I think it's really
right this time). Also, named constants that end in numbers will
produce TeX output with the number as a subscript (this was already
true for variable names).
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: 2989 byte(s)
Diff to
previous 2594
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
2594 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Aug 12 20:17:18 2004 UTC (8 years, 9 months ago) by
dpvc
File length: 2989 byte(s)
Diff to
previous 2592
Fixes for handling intervals better. In particular, deal better with
ambiguous situations, like (1,2) that could be a point.
You can use [a,a] to specify the single point a. I'd like to make {a}
represent this (and maybe even {a,b,c} to form finite sets), but this
would interfere with the use of { and } as alternative parentheses.
(Does anyone really use these?)
Do we need a cross product for intervals (and sets) as a means of
representing regions in R^2 (or higher)?
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: 2908 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: 2884 byte(s)
Diff to
previous 2558
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.