Forums

Search results: 163

inactiveTopicis there a bug in multivar_function_cmp? topic started 8/13/2001; 11:37:09 AM
last post 8/21/2001; 11:59:51 AM
userSusan Diesel - is there a bug in multivar_function_cmp?  blueArrow
8/13/2001; 11:37:09 AM (reads: 1880, responses: 7)
When a student's previous answer is displayed next time he views a problem, I see a compiler error

> Compiler warnings: > * Use of uninitialized value in join at (eval 111) line 2406.

in a problem using multivar_function_cmp when the student's attempt contains variables other than those expected by WW.

<| Post or View Comments |>


userMichael Gage - Re: is there a bug in multivar_function_cmp?  blueArrow
8/13/2001; 12:14:34 PM (reads: 2213, responses: 0)
Can you tell me the file name of the problem? or send the text of the problem?

One other point. Try using fun_cmp() (see manpages). This is a newer version of the multivariable_function_cmp and may have the bugs fixed.

-- Mike

<| Post or View Comments |>


userMichael Gage - Re: is there a bug in multivar_function_cmp?  blueArrow
8/13/2001; 1:06:15 PM (reads: 2227, responses: 1)

So: a student tries an answer using c instead of C and gets
it wrong. Later, student comes back to the problem and sees a
pink screen with a compiler error at the bottom.




## Description
## First order ODE with xy
## EndDescription



DOCUMENT();
loadMacros(PG.pl,
PGbasicmacros.pl,
PGchoicemacros.pl,
PGanswermacros.pl,
PGauxiliaryFunctions.pl,
PGgraphmacros.pl,
"Dartmouthmacros.pl");



## Do NOT show partial correct answers
$showPartialCorrectAnswers = 0;



## Generate some coefficients
$m = non_zero_random(-6,6,1);



## Clean up stuff like -1 x
$func = clean_scalar_string($m, "xy");



## Ok, we are ready to begin...
##
TEXT(beginproblem());




BEGIN_TEXT
$BR
Solve the following first-order differential equation:
\( \displaystyle frac {dy}{dx} = $func \).
\break
Simplify your answer $BBOLD completely$EBOLD. Your answer should look
like \(y = f(x)\).
\break
If an arbitrary constant appears in your answer, you must enter it as an
uppercase C.
\break
For example, a valid answer for the differential equation \( \frac{dy}{dx}
= y \)

would look like \( C e^x \).
$BR
\( y = \)
\{ ans_rule(40) \}
$PAR



END_TEXT




## The answer is



ANS(multivar_function_cmp("C*e**( $m * {x**2/2})",["x","C"]));



ENDDOCUMENT();



Susan J. Diesel

---------------------------------

Hi Susan,

There are a number of possible solutions to this problem.

One would be to make the answer evaluator smarter, so for example variables named C and c are equivalent.

We're working on making it easier to make small changes to existing answer evaluators to handle situations such as this one.

A different way to ask the question is to use fun_cmp() and have the student give a specific solution, (but the instructor gives a general solution which adapts itself to the students answer) see the params option and examples in fun_cmp. I wrote fun_cmp to handle this type of question, but it may not be the question you wanted to ask.

I'll keep thinking to see if there is a cleverer way to handle this problem.

One other question -- does your use of \break display properly in tth mode? and if so how do you accomplish this? ($BR also gives a line break.)

-- Mike

<| Post or View Comments |>


userZbigniew Fiedorowicz - Re: is there a bug in multivar_function_cmp?  blueArrow
8/14/2001; 1:04:02 PM (reads: 2475, responses: 0)
Mike,

I'm using PGanswermacros.pl.old in WeBWorK 1.6, which I understand are the old WeBWorK 1.5 version. This problem works fine with those old answer macros.

>>> A different way to ask the question is to use fun_cmp() and have the student give a specific solution, (but the instructor gives a general solution which adapts itself to the students answer) see the params option and examples in fun_cmp. I wrote fun_cmp to handle this type of question, but it may not be the question you wanted to ask. <<<

This approach doesn't work very well in the WeBWorK 1.6 version of function_cmp_up_to_constant(), as compared to the old 1.5 version of this routine.

Zig Fiedorowicz

<| Post or View Comments |>


userMichael Gage - Re: is there a bug in multivar_function_cmp?  blueArrow
8/20/2001; 6:24:43 PM (reads: 2112, responses: 0)
Hi Zig,

I'm not sure I understand your comment. I don't believe that any of the WeBWorK 1.5 versions will check an answer up to the addition a multiple of a function (such as e^x). Only checking functions 'defined up to a constant' was available and allowed the checking of general solutions to anti-derivatives.

Even in that case I believe that one asked something like:

" Find an anti-derivative of x^2 "

and the answers could be x^3/3 or x^3/3 +456 but NOT x^3/3 + C

Perhaps I'm not thinking of the right sort of example.

-- Mike

<| Post or View Comments |>


userZbigniew Fiedorowicz - Re: is there a bug in multivar_function_cmp?  blueArrow
8/21/2001; 10:20:34 AM (reads: 2149, responses: 0)
Hi Mike,

You misunderstand. I'm not commenting on the specific format of the answers accepted by various answer evaluators. I was making a general comment about the difference in reliability between the version 1.5 and version 1.6 answer evaluators.

My point was that I find the version 1.5 evaluators much more reliable. I found that the version 1.6 evaluators are unaccceptably tolerant of wrong answers. For instance, I found that (logging in as a practice user) in a great majority of indefinite integration problems in Rochester's own spring courses, I could enter nonsensical answers and have them accepted as correct (without much effort on my part). Susan's trouble with multivar_function_cmp seems to be another example of lesser reliability of a version 1.6 evaluator vis-a-vis the 1.5 version.

I am concerned that the "adaption algorithm" you seem to be using in the version 1.6 evaluators has some inherent flaws as compared to the more straightforward algorithms you were using in previous versions.

Zig

<| Post or View Comments |>


userMichael Gage - Re: is there a bug in multivar_function_cmp?  blueArrow
8/21/2001; 10:59:54 AM (reads: 2085, responses: 0)
Hi Zig,

I think I understand now. The original version 1.6 had some difficulties because they adapted the instructor's answer to the student's, allowing the student to spoof correct answers by adding large constants that drowned out the differences between the student answer and the professor's (particularly when using the relative tolerance option).

Now the student's answer is adapted to the professor. This still leaves some ambiguity when using relative accuracy for indefinite integrals, since the actual accuracy required will depend on the answer entered by the professor. e.g. entering x^2 + 10000000 + c will allow quite a bit of actual error, although relative to the professor's answer with c=0 the error will be small. One could argue that relative accuracy should never be used for anti-derivatives since they are not well defined and the student cannot deduce how accurate his answer must be to guarantee 1% relative accuracy with respect to the instructor's answer. That's probably quibbling however since the current setup (and the one in version 1.5) seem to work pretty well in practice, even using relative accuracies.

I'd be interested in knowing if any of the problems which gave false positive answers still have that problem under the new system. You can check any of the UR problems (including many which you contributed from the OSU collection) using the newest macros from the URL:

http://webhost.math.rochester.edu/webworkdocs/ww/listLib?command=setsOnly

We've checked a lot, but it's difficult to check everything. When checking answers to differential equations, where the answer is checked up to a linear combination of exponentials, one still has to be somewhat careful about choosing the domain properly in order to avoid numerical problems when the exponential function is either way too large or way too small. With anti-derivatives I don't anticipate any such problems however.

Thanks for the help and the comments.

-- Mike

<| Post or View Comments |>


userZbigniew Fiedorowicz - Re: is there a bug in multivar_function_cmp?  blueArrow
8/21/2001; 11:59:51 AM (reads: 2107, responses: 0)
Dear Mike,

I took you up on your offer and tried your new answer evaluators on one of my problems, setIntegrals14Substitution/osu_in_14_2.pg. (This was the one which elicited a student complaint which brought the version 1.6 misbehavior to my attention.)

Briefly the problem version I was doing asked to integrate

x^4(6+5x^5)^9

After substituting u = 6+5x^5, you get the integral of u^9/25. I wasn't able to get your new evaluator to accept nonsensical wrong answers. But I found that it would not accept correct answers with even modestly large constants of integrations: eg.

u^10/250+33454

was rejected as incorrect. By contrast, the version 1.5 evaluator currently in use at Ohio State accepted this and variants with much larger constants of integration as correct. (I used "refresh" to obtain exactly the same parameters for the problem.) Moreover it failed gracefully when I put in riduculously large constants of integration with the error message:

Your constant of integration is too large for WeBWorK to deal with or there is some other error.

Certainly the new behavior of your evaluator is much preferable to the old behavior - it's unlikely that a student would enter u^10/250+33454. However it still seems to fall short in reliability compared to the old 1.5 version.

Zig

<| Post or View Comments |>

Forum archive 2000-2006 -> Robert (Rochester ugrad) - Editor

by Arnold Pizer -
inactiveTopicEditor topic started 6/26/2000; 11:18:02 AM
last post 6/26/2000; 11:18:02 AM
userRobert (Rochester ugrad) - Editor  blueArrow
6/26/2000; 11:18:02 AM (reads: 1132, responses: 0)
Right now if the editor is used to change a problem using the refresh option, the change does not take affect in typeset mode. I assume this is because Latex2html does caching outside of the normal Netscape caching.

<| Post or View Comments |>

Forum archive 2000-2006 -> Michael Gage - PG.pl

by Arnold Pizer -
inactiveTopicPG.pl topic started 5/22/2000; 9:29:39 PM
last post 5/22/2000; 9:29:39 PM
userMichael Gage - PG.pl  blueArrow
5/22/2000; 9:29:39 PM (reads: 2978, responses: 0)


NAME

    PG.pl --- located in the courseScripts directory.
Defines the Program Generating language at the most basic level.


SYNPOSIS

    The basic PG problem structure:
    DOCUMENT();     # should be the first statment in the problem
loadMacros(.....); # (optional) load other macro files if needed.
# (loadMacros is defined in F<dangerousMacros.pl>)
    HEADER_TEXT(...);   # (optional) used only for inserting javaScript into problems.
    #                   #   insert text of problems
TEXT("Problem text to be",
"displayed. Enter 1 in this blank:",
ANS_RULE(1,30) # ANS_RULE() defines an answer blank 30 characters long.
# It is defined in F<PGbasicmacros.pl>
);
    ANS( answer_evalutors); # see F<PGanswermacros.pl> for examples of answer evaluatiors.
    ENDDOCUMENT()   # must be the last statement in the problem


DESCRIPTION

As described in the synopsis, this file and the macros DOCUMENT() and ENDDOCUMENT() determine the interface between problems written in the PG language and the rest of WeBWorK, in particular the subroutine createPGtext(() in the file translate.pl.

DOCUMENT() must be the first statement in each problem template. It initializes variables, in particular all of the contents of the environment variable become defined in the problem enviroment. (See webwork_system_html/docs/techdescription/pglanguage/PGenvironment.html)

ENDDOCUMENT() must the last executable statement in any problem template. It returns the rendered problem, answer evaluators and other flags to the rest of WeBWorK, specificially to the routine createPGtext() defined in translate.pl

The HEADER_TEXT(), TEXT(), and ANS() functions load the header text string, the problem text string. and the answer evaulator queue respectively.

DOCUMENT()

DOCUMENT() must be the first statement in each problem template. It can only be used once in each problem.

DOCUMENT() initializes some empty variables and via INITIALIZE_PG() unpacks the variables in the %envir variable which is implicitly passed to the problem. It must be the first statement in any problem template. It also unpacks any answers submitted and places them in the @submittedAnswer list, saves the problem seed in $PG_original_problemSeed in case you need it later, and initializes the pseudo random number generator object in $PG_random_generator.

You can reset the standard number generator using the command:

    $PG_random_generator->srand($new_seed_value);

(See also SRAND in the PGbasicmacros.pl file.)

The environment variable contents is defined in webwork_system_html/docs/techdescription/pglanguage/PGenvironment.html

HEADER_TEXT()

    HEADER_TEXT("string1", "string2", "string3");

The HEADER_TEXT() function concatenates its arguments and places them in the output header text string. It is used for material which is destined to be placed in the header of the html problem -- such as javaScript code. It can be used more than once in a file.

TEXT()

    TEXT("string1", "string2", "string3");

The TEXT() function concatenates its arguments and places them in the output text string. TEXT() is the function which defines text which will appear in the problem. All text must be an argument to this function. Any other statements are calculations (done in perl) which will not directly appear in the output. Think of this as the "print" function for the .pg language. It can be used more than once in a file.

STOP_RENDERING()

    STOP_RENDERING() unless all_answers_are_correct;

No text is printed and no answer blanks or answer evaluators are stored or processed until RESUME_RENDERING() is executed.

RESUME_RENDERING()

    RESUME_RENDERING();

Resumes processing of text, answer blanks, and answer evaluators.

ANS()

    ANS(answer_evaluator1, answer_evaluator2, answer_evaluator3,...)

Places the answer evaluators in the unlabeled answer_evaluator queue. They will be paired with unlabeled answer rules (answer entry blanks) in the order entered. This is the standard method for entering answers.

    LABELED_ANS(answer_evaluater_name1, answer_evaluator1, answer_evaluater_name2,answer_evaluator2,...)

Places the answer evaluators in the labeled answer_evaluator hash. This allows pairing of labeled answer evaluators and labeled answer rules which may not have been entered in the same order.

ENDDOCUMENT()

ENDDOCUMENT() must the last executable statement in any problem template. It can only appear once. It returns an array consisting of

    A reference to a string containing the rendered text of the problem.
A reference to a string containing text to be placed in the header
(for javaScript)
A reference to the array containing the answer evaluators.
(May be changed to a hash soon.)
A reference to an associative array (hash) containing various flags.
    The following flags are set by ENDDOCUMENT:
(1) showPartialCorrectAnswers -- determines whether students are told which
of their answers in a problem are wrong.
(2) recordSubmittedAnswers -- determines whether students submitted answers
are saved.
(3) refreshCachedImages -- determines whether the cached image of the problem
in typeset mode is always refreshed (i.e. setting this to 1 means cached
images are not used).
(4) solutionExits -- indicates the existence of a solution.
(5) hintExits -- indicates the existence of a hint.
(6) comment -- contents of COMMENT commands if any.
(7) showHintLimit -- determines the number of attempts after which hint(s) will
be shown
    (8) PROBLEM_GRADER_TO_USE -- chooses the problem grader to be used in this order
(a) A problem grader specified by the problem using:
install_problem_grader(\&grader);
(b) One of the standard problem graders defined in PGanswermacros.pl when
set to
'std_problem_grader' or 'avg_problem_grader' by the environment variable
$PG_environment{PROBLEM_GRADER_TO_USE}
(c) A subroutine referenced by $PG_environment{PROBLEM_GRADER_TO_USE}
(d) The default &std_problem_grader defined in PGanswermacros.pl

INITIALIZE_PG()

This is executed each DOCUMENT() is called. For backward compatibility loadMacros also checks whether the macroDirectory has been defined and if not, it runs INITIALIZE_PG() and issues a warning.

File path = /ww/webwork/pg/macros/PG.pl

<| Post or View Comments |>