Log of /trunk/pg/lib/Value/Formula.pm
Parent Directory
Revision
2666 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Aug 22 00:56:32 2004 UTC (8 years, 9 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 (8 years, 9 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 (8 years, 9 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
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 (8 years, 9 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 (8 years, 9 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 (8 years, 9 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 (8 years, 9 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).
Use
Context()->texStrings
to start outputting TeX strings, and
Context()->normalStrings
to switch back.
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.