[system] / trunk / pg / lib / Parser / Context / Variables.pm Repository:
ViewVC logotype

Log of /trunk/pg/lib/Parser/Context/Variables.pm

Parent Directory Parent Directory


Links to HEAD: (view) (download) (as text) (annotate)
Sticky Revision:

Revision 5237 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Aug 7 04:30:27 2007 UTC (12 years, 4 months ago) by dpvc
File length: 2681 byte(s)
Diff to previous 5124
Allow Context()->variables-add(name=>[type,options]) format for
declaring a variable.

Revision 5124 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Jul 4 20:13:03 2007 UTC (12 years, 5 months ago) by dpvc
File length: 2620 byte(s)
Diff to previous 5116
Make the patterns be pre-compiled patterns for efficiency.

Revision 5116 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Jul 3 10:44:30 2007 UTC (12 years, 5 months ago) by dpvc
File length: 2618 byte(s)
Diff to previous 4994
Modified the method used to tokenize a formula to use one large
pattern that includes all the token types rather than individual
patterns for variables, strings, operators, and so on.  This allows
the Parser to handle the situation where a token of one type is a
prefix of a token of another type (e.g., < as a parenthesis but <- as
an operator) without worrying about which one is checked first.  The
new mtheod is also more flexible about having additional patterns
(like quoted strings, or arbitrary variable names) and about
specifying the order in which they are applied.

Revision 4994 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Jun 10 01:17:29 2007 UTC (12 years, 6 months ago) by dpvc
File length: 2430 byte(s)
Diff to previous 3913
Update to handle the fact that the Value package now includes the
context with all MathObjects.  (This may still need some work.)

Revision 3913 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Jan 17 01:56:24 2006 UTC (13 years, 10 months ago) by dpvc
File length: 2448 byte(s)
Diff to previous 3866
Fixed problem with variables that are multiplied with no space between
them (e.g., "ax") that was introduced when I changed the pattern to
allow multi-letter variable names.

The solution is to first check against the defined names before
checking for the more complete name pattern.

Revision 3866 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Dec 31 01:39:54 2005 UTC (13 years, 11 months ago) by dpvc
File length: 2524 byte(s)
Diff to previous 3510
Allow multi-letter variable names and names like x1, x2, etc.

Revision 3510 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 13 17:32:58 2005 UTC (14 years, 4 months ago) by dpvc
File length: 2512 byte(s)
Diff to previous 3370
Fixed a problem with redefine when used with classes that store their
data in a on-standard form (i.e., by overridding the create()
method).  Now they can define uncreate() to get the original data back
for use with redefine().

Revision 3370 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Jul 12 22:29:53 2005 UTC (14 years, 5 months ago) by dpvc
File length: 2473 byte(s)
Diff to previous 2687
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 2687 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 27 00:28:27 2004 UTC (15 years, 3 months ago) by dpvc
File length: 2470 byte(s)
Diff to previous 2666
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 2666 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Aug 22 00:56:32 2004 UTC (15 years, 3 months ago) by dpvc
File length: 1928 byte(s)
Diff to previous 2658
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 2658 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 20 11:17:06 2004 UTC (15 years, 3 months ago) by dpvc
File length: 1683 byte(s)
Diff to previous 2622
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 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: 1640 byte(s)
Diff to previous 2579
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 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: 1598 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.

Revision 2558 - (view) (download) (as text) (annotate) - [select for diffs]
Added Wed Jul 28 20:32:33 2004 UTC (15 years, 4 months ago) by sh002i
File length: 1599 byte(s)
merged changes from rel-2-1-a1 -- stop using that branch.

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.

  Diffs between and
  Type of Diff should be a

Sort log by:

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9