NAME

PGasu.pl -- located in the pg/macros directory

SYNPOSIS

Macros contributed by John Jones

auto_right()

Usage: ANS(auto_right());

or

ANS(auto_right("this answer can be left blank"));

This answer checker marks any answer correct. It is useful when you want to leave multiple answer blanks, only some of which will be used. If you turn off showing partial correct answers and partial credit, the effect is not visible to the students. The comment in the second case is what will be displayed as the correct answer. This helps avoid confusion.

no_decs()

Can be wrapped around an numerical evaluation. It marks the answer wrong if it contains a decimal point. Usage:

ANS(no_decs(num_cmp("sqrt(3)")));

This will accept "sqrt(3)" or "3^(1/2)" as answers, but not 1.7320508

must_include()

Wrapper for other answer evaluators. It insists that a string is part of the answer to be marked right.

no_trig_fun()

Wrapper for other answer evaluators. It marks the answer wrong if it contains one of the six basic trig functions.

This is useful if you want students to report the value of sin(pi/4), but you don't want to allow "sin(pi/4)" as the answer.

A similar effect can be accomplished with Contexts() by undefining the trig functions. See http://webwork.maa.org/wiki/Modifying_contexts_%28advanced%29#.282.29_Functions

no_trig()

exact_no_trig()

must_have_filter()

Filter for checking that an answer has (or doesn't have) a certain string in it. This can be used to screen answers where you want them in a particular form (e.g., if you allow most functions, but not trig functions in the answer, or if the answer must include some string).

First argument is the string to have, or not have Second argument is optional, and tells us whether yes or no Third argument is the error message to produce (if any).

When using this filter directly, you also need to install catch_errors_filter as a post filter.

A similar effect can be accomplished with Contexts() by undefining the trig functions. See http://webwork.maa.org/wiki/Modifying_contexts_%28advanced%29

catch_errors_filter()

raw_student_answer_filter()

no_decimal_list()

no_decimals()

with_comments()

# Wrapper for an answer evaluator which can also supply comments

pc_evaluator()

# Wrapper for multiple answer evaluators, it takes a list of the following as inputs
# [answer_evaluator, partial credit factor, comment]
# it applies evaluators from the list until it hits one with positive credit,
# weights it by the partial credit factor, and throws in its comment

weighted_partial_grader

This is a grader which weights the different parts of the problem differently. The weights passed to it through the environment. In the problem:

$ENV{'partial_weights'} = [.2,.2,.2,.3];

This will soon be superceded by a better grader.