[system] / trunk / pg / lib / Value / Formula.pm Repository:
ViewVC logotype

Log of /trunk/pg/lib/Value/Formula.pm

Parent Directory Parent Directory

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

Revision 2800 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Sep 19 14:27:39 2004 UTC (15 years, 5 months ago) by dpvc
File length: 12853 byte(s)
Diff to previous 2688
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 2688 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 27 19:42:59 2004 UTC (15 years, 5 months ago) by dpvc
File length: 12780 byte(s)
Diff to previous 2687
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


Finally, don't look for adaptive parameters if they aren't actually
used in the professor's formula (even if they are defined).

Revision 2687 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 27 00:28:27 2004 UTC (15 years, 5 months ago) by dpvc
File length: 12344 byte(s)
Diff to previous 2678
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


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 2678 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Aug 23 23:55:37 2004 UTC (15 years, 5 months ago) by dpvc
File length: 10631 byte(s)
Diff to previous 2671
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 2671 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Aug 22 21:18:06 2004 UTC (15 years, 5 months ago) by dpvc
File length: 10559 byte(s)
Diff to previous 2669
Fixed some inconsistencies between handing of matrices within the
parser and Value packages.  Added a predefined Matrix context.

Revision 2669 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Aug 22 15:42:50 2004 UTC (15 years, 5 months ago) by dpvc
File length: 10521 byte(s)
Diff to previous 2668
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:

              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 2668 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Aug 22 02:55:38 2004 UTC (15 years, 5 months ago) by dpvc
File length: 10149 byte(s)
Diff to previous 2666
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 2666 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Aug 22 00:56:32 2004 UTC (15 years, 5 months ago) by dpvc
File length: 10204 byte(s)
Diff to previous 2629
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 2629 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Aug 17 02:01:27 2004 UTC (15 years, 6 months ago) by dpvc
File length: 8353 byte(s)
Diff to previous 2625
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 2625 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Aug 16 18:35:12 2004 UTC (15 years, 6 months ago) by dpvc
File length: 8351 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

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, 6 months ago) by dpvc
File length: 8052 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, 6 months ago) by dpvc
File length: 7897 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, 6 months ago) by dpvc
File length: 3677 byte(s)
Diff to previous 2606
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 2606 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 14 11:25:47 2004 UTC (15 years, 6 months ago) by dpvc
File length: 3508 byte(s)
Diff to previous 2558
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).



to start outputting TeX strings, and


to switch back.

Revision 2558 - (view) (download) (as text) (annotate) - [select for diffs]
Added Wed Jul 28 20:32:33 2004 UTC (15 years, 6 months ago) by sh002i
File length: 3573 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