Log of /trunk/pg/lib/Value.pm
Parent Directory
Revision
5919 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Sep 23 21:52:56 2008 UTC (11 years, 2 months ago) by
dpvc
File length: 30652 byte(s)
Diff to
previous 5755
Handle the no-inherit values better by deleting them from the copy
before inserting the ones from the original hash. That way, you don't
lose your copies of those values, you just don't inherit from the
given objects.
Revision
5709 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Jun 20 15:02:22 2008 UTC (11 years, 5 months ago) by
dpvc
File length: 30529 byte(s)
Diff to
previous 5703
Make non-inheritance scheme more general, and include additional
values in the default list. (Still need to look through all the basic
objects to see what might not want to be inherited.)
Revision
5520 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Sep 24 22:33:16 2007 UTC (12 years, 2 months ago) by
dpvc
File length: 30125 byte(s)
Diff to
previous 5468
Update the List() object to not add "(" and ")" around the list unless
they are explicitly entered by the author. This prevents extraneous
parentheses from being introduced into the problem text that the
author hadn't expected.
Parentheses now are added only for nested lists, as in
List(1,List(2,3)), which will display as "1, (2, 3)", not "1, 2, 3".
Revision
5468 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Sep 8 21:33:53 2007 UTC (12 years, 3 months ago) by
dpvc
File length: 30084 byte(s)
Diff to
previous 5431
The make() method now inherits all the settings of the parent object,
so that flags set by the user (e.g., tolerances, periods, and so on)
will be passed on as new objects are created. For example, in
$x = Real(1)=>with(tolerance=>.0001);
$y = sin($x);
$y will also have tolerance set to .0001.
This also applies to binary operations, where the result will now
inherit all the values of either operand, with the left-hand operand
taking precedence when they both have a flag set but to different
values.
This is a significant change, and there may be unforeseen side effects
that I'll have to take care of as they appear. It passes my test
suite, however, so I'm hoping they will be limited.
Revision
5363 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 18 23:33:05 2007 UTC (12 years, 3 months ago) by
dpvc
File length: 29252 byte(s)
Diff to
previous 5362
Added a number of methods to improve the ability to test unknown
values for their types (e.g., isHash, isBlessed, etc), and modified
several of the service routines to use them.
Improved the isValue and related routines to use more sophisticated
methods of determining whether a class is a MathObject.
Made the UNIVERSAL isa() and can() methods available for use from
within the safe compartment.
Some miscellaneous cleanup.
Revision
5362 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 18 21:47:03 2007 UTC (12 years, 3 months ago) by
dpvc
File length: 28164 byte(s)
Diff to
previous 5349
The changes in version 1.81 broke promotion of objects created by hand
through the MathObject constructors since they don't have open and
close explicitly like the parsed versions do. So check the context
for the default parens for these.
Revision
5348 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Aug 17 19:37:53 2007 UTC (12 years, 3 months ago) by
dpvc
File length: 27979 byte(s)
Diff to
previous 5330
Modified Value::Error so that it works as a method as well as a direct
call. So you can use Value::Error(), Value->Error() or $mathObj->Error()
to call it. I probably should change all the Value::Error calls to
Value->Error ones, but may not bother, as there is not much gain in
it and I've gotten pretty used to it the way it is.
Also fixed a typo where the showTraceback flag was not being honored.
Revision
5330 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Aug 15 04:09:41 2007 UTC (12 years, 3 months ago) by
dpvc
File length: 27660 byte(s)
Diff to
previous 5246
Added a Ref() function that returns the reference address (for
checking if two MathObject references are to the identical object).
Without this, the objects would be compared as MathObjects rather than
perl references.
Revision
5170 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Jul 13 20:50:45 2007 UTC (12 years, 4 months ago) by
dpvc
File length: 27567 byte(s)
Diff to
previous 5128
Make Real and Complex objects promote their period fields so that they
can be specified as strings rather than actual objects.
Also make the default promote() routine be the more sophisticated one
used by Real and Complex (and so remove the reoutine from those objects).
Revision
5128 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Jul 6 15:22:29 2007 UTC (12 years, 5 months ago) by
dpvc
File length: 27403 byte(s)
Diff to
previous 5112
Have getFlag look in the equation's equation for the flag as well (so
that formulas that are split into separate formulas will have their
points be able to find flags from the original list-values formula.
Revision
5112 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Jul 2 16:18:49 2007 UTC (12 years, 5 months ago) by
dpvc
File length: 27251 byte(s)
Diff to
previous 5106
Make getFlag() look for an {equation} field and add that into the
search path for the flag. This lets Formula object tag their results
so that printing and comparisons will use the flags from the Formula
for formats and tolerances.
Revision
5090 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Jun 30 00:26:42 2007 UTC (12 years, 5 months ago) by
dpvc
File length: 27074 byte(s)
Diff to
previous 5089
Allow empty open and close parens for canBeInUnion method.
Reverse order of loops in transferFlags so that we can skip the
transfer if there is no flag in the object (true most of the time).
Revision
5089 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Jun 29 22:07:10 2007 UTC (12 years, 5 months ago) by
dpvc
File length: 27028 byte(s)
Diff to
previous 5083
Transfer flags from parent objects to their children for comparisons
and printing purposes. Also touch up a few type-coersion issues. (It
may be possible to not to need Value::isValue() if these can all be
taken care of.)
Revision
5068 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Jun 28 22:45:57 2007 UTC (12 years, 5 months ago) by
dpvc
File length: 26591 byte(s)
Diff to
previous 5060
Look for the StringifyAsTeX flag in the current context only (not the
original context of the object). This will make Context()->texStrings
work properly even when some objects are created in other contexts.
Revision
5042 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Jun 28 01:31:09 2007 UTC (12 years, 5 months ago) by
dpvc
File length: 26565 byte(s)
Diff to
previous 5041
Recent changes to automatically do promotion in the Value methods was
a mistake. I put it back into the subclass methods again.
Revision
5037 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Jun 27 19:50:45 2007 UTC (12 years, 5 months ago) by
dpvc
File length: 26368 byte(s)
Diff to
previous 5026
Changed the with() method to produce a (shallow) copy rather than
modify the original object. So now $x->with(foo=>'bar') will make a
copy of $x with a field "foo" set to "bar" rather than set "foo" to
"bar" in $x itself.
(This is in response to discussion from our June 26th meeting at UofR.)
Revision
5026 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Jun 23 20:08:07 2007 UTC (12 years, 5 months ago) by
dpvc
File length: 26342 byte(s)
Diff to
previous 5005
Make the Package method really be a method of the context rather than
the Value objects, and make the Value method call the context one.
This means it is not necessary to pass the context as a parameter any
longer.
Revision
5001 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Jun 12 04:05:56 2007 UTC (12 years, 5 months ago) by
dpvc
File length: 26662 byte(s)
Diff to
previous 4996
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
4996 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Jun 10 11:34:27 2007 UTC (12 years, 6 months ago) by
dpvc
File length: 26648 byte(s)
Diff to
previous 4995
Allow promote() to accept a context as the first argument so that the
promoted object can be forced into the given context.
Revision
4993 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Jun 8 12:09:53 2007 UTC (12 years, 6 months ago) by
dpvc
File length: 26651 byte(s)
Diff to
previous 4991
Added more flexible type checking for MathObject classes. This makes
it possible to correctly match types even when the context has
specified a different package to handle a given type, for example.
Revision
4991 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Jun 8 02:09:21 2007 UTC (12 years, 6 months ago) by
dpvc
File length: 26107 byte(s)
Diff to
previous 4987
Update new() and make() methods to accept a context as the first
parameter (making it easier to create objects in a given context
without having to resort to a separate call to coerce them to the
given context after the fact).
Revision
4987 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Jun 7 21:54:46 2007 UTC (12 years, 6 months ago) by
dpvc
File length: 26039 byte(s)
Diff to
previous 4979
Added Value->Package(name[,context]) to look up what package is
currently set to handle the named type. E.g.,
Value->Package("Complex") usually returns "Value::Complex". These can
be overridden in the Context so that modified vesions of the
MathObjects can be made to replace the existing ones more easily. In
particular, the Parser classes should call these (not yet implemented)
when they create objects, so that you can override the object they
create.
Also cleaned up some more context issues (with still more to come).
Revision
4979 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Jun 7 11:59:05 2007 UTC (12 years, 6 months ago) by
dpvc
File length: 25482 byte(s)
Diff to
previous 4975
More updates for marking MathObjects with the context in which they
were created, so they should now work like the Formula objects in that
respect. As they are combined via overloaded operators, they should
pass on their contexts correctly.
Also normalized the use of getFlag() to obtain flags from the
MathObject's context rather than looking in the context directly.
This allows the math object to override the flag by setting the flag
value in the object's hash (e.g., $f->{tolerance} = .001). I've also
added the ability to override context flags via the answerHash (e.g.,
$f->cmp(tolerance => .001)), though some filtering may need to be
added to this at some point. Note that ONLY the context flags can be
overridden, not other parts of the context.
Revision
4975 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Jun 6 21:44:05 2007 UTC (12 years, 6 months ago) by
dpvc
File length: 24978 byte(s)
Diff to
previous 4827
This begins some major updates to the Parser and Value libraries.
This may make the MathObjects unstable as things shake down, but I'll
try to keep that to a minimum.
This update reorganizes how the overloading of operations are
implemented. The base Value class is now overloaded rather than the
individual Value classes. This makes it easier to make subclasses
that take advantage of the overloading.
The code that handles promoting one MathObject to another has been
updated as a part of this. This should also make subclassing the
existing MathObjects more flexible.
In the past, Formula objects included a pointer to the Context in
which the object was created, but other MathObject did not. This
update is the first round of updates to include the context in the
other MathObjects, but more work needs to be done.
The changes here should not affect existing problems; it is possible
that some macro files will need to be updated, but none of the
standard ones in pg/macros seem to need it at the moment.
Revision
4043 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Apr 6 00:20:01 2006 UTC (13 years, 8 months ago) by
dpvc
File length: 19031 byte(s)
Diff to
previous 3871
Fixed getFlag so that it sodesn't accidentally create the {context}
field of an object that doesn't already have one (Perl will create
hashes that don't already exist if you reference them). This was
causing problems with the ans_array processing
Revision
3716 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Oct 16 03:37:17 2005 UTC (14 years, 1 month ago) by
dpvc
File length: 18983 byte(s)
Diff to
previous 3669
In the past, when Value objects were inserted into strings, they would
automatically include parentheses so that if you had $f equal to 1+x
and $g equal to 1-x, then Formula("$f/$g") would mean (1+x)/(1-x)
rather than 1+(x/1)-x, which is what would happen as a straing string
substitution.
The problem is that this would also happen for real numbers, vectors,
and everything else, even when it wasn't necessary. So if $x=Real(3),
then "Let x = $x" would be "Let x = (3)".
I have changed the behavior of the string concatenation for Value
objects so that parentheses are only added in a few cases: for
Formulas, Complex numbers, and Unions. This makes the other Value
objects work more like regular variables in strings, but might cause
some problems with strings that are used as formulas. For example, if
$a = Real(-3), then "x + 2 $a" will become "x + 2 -3", or "x-1" rather
than the expected "x - 6". (The old approach would have made it "x +
2 (-3)" which would have worked properly). For the most part, it is
easier to use something like "x + 2*$a" or even "x" + 2*$a in this
case, so the extra trouble of having to avoid parentheses when you
really meant to substitute the value into a string didn't seem worth
it.
Revision
3669 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Sep 29 22:02:07 2005 UTC (14 years, 2 months ago) by
dpvc
File length: 18889 byte(s)
Diff to
previous 3652
Fixed a problem with the automatic upgrading of object classes for
when Value objects are subclassed but are not entered into the
precedence list.
Revision
3652 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Sep 24 00:47:30 2005 UTC (14 years, 2 months ago) by
dpvc
File length: 18870 byte(s)
Diff to
previous 3628
Added ability to have answers that are empty strings. String("") now
will produce a valid string object regardless of the Context's defined
string values. (You can prevent this using
Context()->flags->set(allowEmptyStrings=>0);
if you wish). String("")->cmp will produce an answer checker for an
empty string (it removes the blank checker that WW installs).
Revision
3524 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Aug 14 00:18:46 2005 UTC (14 years, 3 months ago) by
dpvc
File length: 18641 byte(s)
Diff to
previous 3522
Added a copy method that produces a deep copy of the given object.
This probably should be used through the new() methods to ducplicate
the data used when creating an object, otherwise changes to the
sub-objects will cause changes to the outer one. For example, if an
interval is used to create a union and then the internal data for the
interval is changed by hand, the changes will also occur in the
union. That is, Value objects contain their data by REFERENCE. This
should probably be changed, but fortunately, no one should be
adjusting the internal structure of the objects by hand.
Revision
3516 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 13 20:59:28 2005 UTC (14 years, 3 months ago) by
dpvc
File length: 18297 byte(s)
Diff to
previous 3509
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 (14 years, 3 months ago) by
dpvc
File length: 18061 byte(s)
Diff to
previous 3468
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
3468 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Aug 11 14:22:36 2005 UTC (14 years, 3 months ago) by
dpvc
File length: 17381 byte(s)
Diff to
previous 3459
Added in the Set object class. Also made more comprehensive defaults
for string, TeX and perl output, so these don't have to be subclassed
so often. These handle looking up the open and close parens and
recursively handling the entries in a list-type object.
Revision
3370 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Jul 12 22:29:53 2005 UTC (14 years, 4 months ago) by
dpvc
File length: 15578 byte(s)
Diff to
previous 3352
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
3352 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Jul 5 01:38:19 2005 UTC (14 years, 5 months ago) by
dpvc
File length: 15486 byte(s)
Diff to
previous 3264
Modified the perl() method to make calles to Value:: directly rather
than to the main:: stubs for creating Value objects. This will make
it work better from within packages or when Parser.pl hasn't been
loaded.
A few things still won't work in this case; e.g., calls to Closed()
for intervals (these could be handled better using ->with()) and to
functions like Factorial and log10 that are defined in Parser.pl.
Finally, there should be better object-based control over what
routines are called to create these objects, so that subclasses of the
Value objects will be able to be generated correctly.
Revision
3259 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Jun 3 22:03:23 2005 UTC (14 years, 6 months ago) by
dpvc
File length: 15398 byte(s)
Diff to
previous 3192
Added a ->with() method that lets you set fields of a Parser object as
you create it. For example:
$f = Formula("sqrt(x)")->with(limits=>[0,3]);
or
ANS(Formula("(x+1)/x")->with(checkUndefinedPoints=>1,test_at=>[[0]])->cmp);
or
ANS($f->with(test_points=>[[0],[1],[2]])->cmp);
Revision
3192 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Mar 16 13:30:28 2005 UTC (14 years, 8 months ago) by
dpvc
File length: 15160 byte(s)
Diff to
previous 3171
Update the overloaded operators so that they can be overridden by
subclasses of the predefined object classes. This involves calling
the objects method rather than using a hard reference to the routine
in the parent class.
Also, change the name of the string comparison routine to
compare_string to avoid conflicts with cmp that is used to produce the
answer checker for the class.
Finally, in Value.pm, promotePrecedence no longer has to do fancy
footwork to get "special" precedence to work (this was a hack to get
around the misfeature of the overloaded operators -- now that that is
being handled correctly, there is no need for it).
Revision
3171 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Feb 15 21:53:23 2005 UTC (14 years, 9 months ago) by
dpvc
File length: 15212 byte(s)
Diff to
previous 3166
Improved the Real(), Complex(), Point(), Vector(), Matrix() and
String() constructors so that they will process formulas passed to
them as strings rather than requiring perl objects for these.
For example, you can use Real("2/3") rather than Real(2/3) if you
want. Also, Real("1+x") will return a formula returning a real
(essentially the same as Formula("1+x") in this case).
Revision
3166 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Feb 15 02:20:52 2005 UTC (14 years, 9 months ago) by
dpvc
File length: 15562 byte(s)
Diff to
previous 2936
Fixed an error with Matrix() that could cause it to loop infinitely
when bad data is passed to it.
Also, allow Matrix(), Point(), Vector(), and Real() to accept string
values that are evaluated to produce the value returned.
(Sorry, accidentally committed with a blank message.)
Revision
2796 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Sep 19 01:15:03 2004 UTC (15 years, 2 months ago) by
dpvc
File length: 14788 byte(s)
Diff to
previous 2688
Added flags that control the reductions performed by
Formula()->reduce. Each reduction operation can be individually
enabled or disabled in the context, and in the reduce() call itself.
More complex reductions need to be developed.
Revision
2688 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Aug 27 19:42:59 2004 UTC (15 years, 3 months ago) by
dpvc
File length: 14738 byte(s)
Diff to
previous 2678
Added in functMaxConstantOfIntegration support in the adaptive
parameter answer checking. Also added a flag to the formula answer
checker that allows checking a formula up to a constant (for
integration problems). This really just adds a new parameter to the
context and adds that to the formula, so there is nothing deep about
this.
ANS(Formula("2x")->cmp(upToConstant=>1));
Finally, don't look for adaptive parameters if they aren't actually
used in the professor's formula (even if they are defined).
Revision
2678 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Aug 23 23:55:37 2004 UTC (15 years, 3 months ago) by
dpvc
File length: 14714 byte(s)
Diff to
previous 2670
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
2669 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Aug 22 15:42:50 2004 UTC (15 years, 3 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 (15 years, 3 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 (15 years, 3 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 (15 years, 3 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 (15 years, 3 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 (15 years, 3 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 (15 years, 3 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 (15 years, 3 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 (15 years, 3 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 (15 years, 3 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 (15 years, 3 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 (15 years, 3 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 (15 years, 3 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 (15 years, 3 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 (15 years, 3 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 (15 years, 4 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.