Sticky Revision: |

Revision

Modified

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

Modified

Missed one situation when making the previous update. Fixed it.

Revision

Modified

Fixed it so that direct calls to the add, sub, mult, etc functions would work as expected (even though there is no need to call them directly).

Revision

Modified

Updated the answer checkers so that you can more easily specify how the correct answer shoudl be displayed. In the past, you could use something like Real(sqrt(2))->cmp(correct_ans=>"sqrt(2)") to do this, but that is awkward. Now the Compute() function (which parses and then evaluates a string) sets things up so that the original string will be what is used as the correct answer. That means Compute("sqrt(2)")->cmp will have the same result as the example above. You can also set the {correct_ans} properly of any Parser object to have that value used as the correct answer. For example $x = Real(sqrt(2)); $x->{correct_ans} = "sqrt(2)"; ANS($x->cmp) would also produce the same answer checker as the two previous examples. All three methods should work. Use the one that is most convenient for you.

Revision

Modified

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

Modified

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

Modified

*** empty log message ***

Revision

Modified

Fixed index problem with matrix multiplciation. (It was returning the transpose!)

Revision

Modified

Added "areParallel" method as a synonym for "isParallel".

Revision

Modified

Clear error messages before doing the answer check (this clears old messages left over inclass this checker is called by another one, e.g. when using UNORDERD_ANS()).

Revision

Modified

Added support for useBaseTenLogs to make log() work like ln() or log10() depending on the value in the course.conf file. Also fixed a bug that caused the WeBWorK parameters not to be copied into contexts by initCopy().

Revision

Modified

Report errors for powers of negative numbers rather than return 'nan'. Don't allow 'nan' to be made into a Real object.

Revision

Modified

Don't give coordinate hints during parallel vector checks. Also fixed a typo.

Revision

Modified

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

Modified

Added a new flag to the Formula()->cmp answer checker that allows a constant-valued formula to be evaluated and then use the checker for the resulting type. This is useful when you want the correct answer for a numeric check to be shown in a symbolic form (like "pi/4") rather than as a decimal number. To do this, use Formula("pi/4")->cmp(eval=>1); rather than Real(pi/4)->cmp, which would show the correct answer as 0.785398. Note that Formula("pi/4")->cmp would also match against pi/4, but it does it as a function rather than a number, so error messages might be issued indicating that the checker is expecting a formula that returns a number, rather than just a number; this might be confusing to a student. It would also accept answers like "pi/4-x+x" as correct, whereas with eval=>1 this would produce an error message saying that the answer was supposed to be a number not a formula returning a number. Similarly, if you want to show sqrt(2)/2 as the correct answer, use Context()->flags->set(reduceConstants=>0, reduceConstantFunctions=>0); Formula("sqrt(2)/2")->cmp(eval=>1); The first line tells the parser not to automatically reduce expressions that only involve constants, so that the value of the formula in the second line will not be reduced to a decimal before the cmp method is called.

Revision

Modified

Don't reduce constants in the display of student answers (so they can tell how the parser interprets their answer). The drawback is that the final number is not displayed. (We may need to add more columns to the results display.)

Revision

Modified

Use extra parens in the string version of the student's answer, but not in the professor's (unless the problem sets the showExtraParens flag).

Revision

Modified

Make partial credit in list answer checkers be the default (now that WeBWorK can handle this).

Revision

Modified

Fixed a bug with constants where the values were being cached so that changes in the context were not being reflected in the formulas that use them.

Revision

Modified

No longer produces the message that there are too many answers if hints are being shown about individual entries in a list. (This gave away the answer about which ones to remove.)

Revision

Modified

Use the current context if the answer doesn't have one itself (like with Value objects).

Revision

Modified

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

Modified

Added ability to have linear adaptive parameters in the function answer checker. It only works for real-valued functions, though. To use a parameter, use Context()->variables->add(a=>'Parameter'); and then use 'a' as a variable within your answer. The student will not be allowed to enter the parameter, but the professor will. Note that the correct answer will show the full professor's answer, including the parameters, even though the student can't type it. Is this the right behaviour?

Revision

Modified

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

Modified

Remove more lines in error messages produced while evaluation student answers.

Revision

Modified

Moved WW-specific routines from Parser.pm to WeBWorK.pm. Changed error reporting when the error message was not generated by the parser directly. (The stack trace and line number references are removed before the error is reported.)

Revision

Modified

Fixed some inconsistencies between handing of matrices within the parser and Value packages. Added a predefined Matrix context.

Revision

Modified

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

Modified

Fixed TeX output of Matrices to use \array rather than \matrix for matrices with formulas as entries (this had already been fixed for constant matrices). Made intervals produce formulas when of of the endpoints is a formula. Removed unneeded comment.

Revision

Modified

Added support for dimension warnings in the answer checker for formulas that return points, vectors or matrices.

Revision

Modified

Formulas can now be compared even if their variables are complex numbers, or even points or vectors! This makes it possible to ask students for complex functions like z^2+i and so on. You can specify limits for variables either via Context()->variables->set(x=>{limits=>[0,1]}) (for reals) or Context()->variables->set(z=>{limits=>[[-2,2],[0,1]]}) (for complexes). Similarly for points and vectors (where the number of sub arrays depends on the dimension). You can also give the limits for a specific formula by assigning to its ->{limits} field: $f = Formula("sqrt(x-10)"); $f->{limits} = [10,12]; There are now named variable types for 'Point2D', 'Point3D', 'Vector2D' and 'Vector3D', in addition to 'Real' and 'Complex'. You can also specify a variable type by giving an explicit instance of a value of the given type. E.g. Context()->variables->add(x=>'Real',y=>0); # two real variables Context()->variables->add(z=>'Complex',w=>i); # two complexes Context()->variables->add(r=>Vector(0,0,0)); # a vector in R^3 Context()->variables->add(X=>'Vector3D'); # a vector in R^3 There still needs to be more error checking in processing user-supplied limits, but I'm not sure how much overhead is worth it.

Revision

Modified

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

Modified

A number of fixes to make handing lists work better. In particular, you can now specify checks for whether the right kinds of parentheses (or none at all) are used on the student's answer. Some of the flags for the list checker have been changed to accommodate this.

Revision

Modified

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

Modified

Make blank patterns be ^$ (which should never match) rather than empty (which always matches). this fixes a problem where if a context has no functions, for example, the parser would attempt to create function calls to a function named ''.

Revision

Modified

We need to protect the HTML in the professor's answer so that if it contains <, for example, it won't disappear.

Revision

Modified

Fixed an error in the generation of regexp patterns for the various data types.

Revision

Modified

The answer checkers now work with subclasses of Formulas that are not part of the Value:: package tree itself (we call Value::isFormula() rather than checking the class directly). I also removed the various cmp_* flags that stored method names as they ended up not needing to be used (they were intended as a means of overriding the default method names, but subclassing turned out to be a better approach). I moved some initialization of the answer checker out of the anonymous subroutine that is installed in the checker and just have that subroutine call the correct answer's main checker (which I renamed). Finally, I changed the student_ans value to be an HTMLized version of the student answer, since the student could include things like < in his answer (e.g., for vectors), in which case his whole answer might disappear. I wonder if this couldn't be handled better at a higher level, as it seems wrong to make the student_ans be HTML rather than the parsed string. I originally thought Problem.pm could do the protecting of HTML special characters, but this won't work without additional changes, since some answer checkers put HTML into student_ans to mark sytanx errors in the student answer, and you DON'T want to protect those HTML characters. The student_ans field is probably being misused in this, and there might want to be another field that gets used by Problem.pm in place of student_ans (which can be HTML protected) when it is non-empty; say student_HTML or something like that. The answer checkers could use that field if it wants to add HTML to the student answer, and student_ans otherwise, with the assurance that it's HTML characters will be protected. That way, if a second answer checker calls the first (like some list checkers do), then the second checker doesn't have to worry about removing HTML from the student ans, and doesn't ahve to wonder whether the student_ans actually contains an error message or syntax markings rather than the actual student answer.

Revision

Modified

Changed the string used for the student answer to be taken from the unevaluated formula rather than the fully-evaluated one. This leaves constants unreplaced, for one thing. Currently the parser combines constants automatically during the parse [which should be controllable by a flag], so student answers that produce numbers are fully evaluated at this point already, except for constant substitution. This could be changed so that even for numberic results, the student sees the parsed expression (rather than the numeric result), which might help them identify where they and the parser differ in their interpretation. It is still nice to see the final computed result, however, but there is no place to show the parsed input as well as the final result. One solution would be to add another column (wasting space). Another would be to make the value shown be "parsed-value = computed-value" when they are not the same thing. A bit ugly, but works within the current framework.

Revision

Modified

Fixed typo in name of random generator.

Revision

Modified

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

Modified

Removed unwanted side-effects of some type-match checks, and moved the ignoreStrings flag so that it is available for the checkers of ANY type.

Revision

Modified

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

Modified

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

Modified

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

Modified

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

Modified

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

Modified

The Union answer checker now uses the generic List checker, so that it will be able to produce partial credit and hints about which Intervals are correct.

Revision

Modified

*** empty log message ***

Revision

Modified

Fixed some bugs in the handle of the context in ->string and ->TeX methods of Value objects.

Revision

Modified

Fixed a typo in one of the parser answer checkers. Added a line that was incorrecctly removed in the parser.

Revision

Modified

The class file for the Value::String object. (Forgot to add it before the last commit. Sorry!)

Revision

Modified

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

Modified

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

Modified

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

Modified

Fixed some output issues with intervals and unions.

Revision

Modified

Added an Infinite object class for the Value package. Still need to add it to the Parser package.

Revision

Modified

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

Modified

Handle list entries that are not Value objects better.

Revision

Modified

The List object's answer checker is now considerably improved. It will allow you to specify an unorderd or ordered check, and whether to print various kinds of hints for wrong answers. The checker can return partial credit, but WW doesn't deal well with this at the moment (some small changes to Problem.pm can take care of that). Partial credit should be based on $showPartialCorrectAnswers, but it is disabled for now. The list answer checker probably still needs some work, especially with non-numeric lists.

Revision

Modified

Added answer checker for parallel vectors. Added option to number checker to have it not report type mismatches for the known strings (like 'infinity'). (Really need a class for infinities, and a Value.pm class for strings.)

Revision

Modified

Have parser handle infinities better.

Revision

Modified

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

Modified

This is a preliminary attempt at adding answer checkers that use the parser. If you have a parser object (like a formula or a vector), you can use the ->cmp method to get an answer checker appropriate for the object. For example: Context('Vector'); $v = Vector(1,2,3); # print text of problem ANS($v->cmp); would produce an answer checker that matched against the vector <1,2,3>. Most of the parameters are set in the Context, but additional ones can be passed to the checker (this still needs work). See the sample problems for more examples. The checkers for Reals, Complexes, Points, Vectors, Matrices and Intervals work pretty well. The ones for List and Union objects need more work, as they only do an ORDERED check at the moment (the student answers must be in the same order). This needs to be fixed. The checker for Formula objects (which corresponds to fun_cmp) still needs to be written.

Revision

Modified

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

Modified

Forgot to add this file. It implements the "fuzzy real" class.

Revision

Modified

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.

Revision

Added

merged changes from rel-2-1-a1 -- stop using that branch.

aubreyja at gmail dot com | ViewVC Help |

Powered by ViewVC 1.0.9 |