[ww-bugs] Bug 3551: LinearInequality not working

bugzilla-daemon at webwork.maa.org bugzilla-daemon at webwork.maa.org
Sat Dec 19 17:57:29 EST 2015


http://bugs.webwork.maa.org/show_bug.cgi?id=3551





--- Comment #3 from Paul Pearson <paultpearson at gmail.com>  2015-12-19 17:57:29 ---
Hi Mike,

For statistics, I would like to be able to write free response questions for
the observed sample statistic, the null hypothesis, and the alternative
hypothesis where students enter answers such as "phat = 0.62", "pi = 0.5", or
"pi > 0.5".  I would imagine that other people would use the LinearInequality
macro in a multivariable setting (e.g., x + 2y + 3z < 6).

The contextInequalities.pl macro is not sufficient for what I want to do.  In
particular, in an Inequalities context a MathObject such as

Compute("pi > 0.5")

get's checked using an interval answer checker "under the hood" and the
variable name gets ignored.  Consequently, a student could enter "phat > 0.5"
or "pi > 0.5" and get marked correct for either answer because the variable
name is being ignored.  As a temporary work-around this last semester, I had
two separate inequalities contexts (one with only the variable "phat" and
another with only the variable "pi").  To see what I mean, submit both the
correct and suggested incorrect answers in the pg problem below my signature. 
I think I asked Davide Cervone about this problem many years ago when the
Inequalities context was first released.  I think his response was "I'm not
going to fix that now...here's a kludgy work around."  I could be mistaken
about that, though.

Thanks!

Paul

#############################################

DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGML.pl",
"contextInequalities.pl",
);
TEXT(beginproblem());

Context("Inequalities");
Context()->constants->remove('pi');
Context()->variables->are('pi'=>['Real','TeX'=>'\pi'],'phat'=>['Real','TeX'=>'\widehat{p}']);

$ans1 = Compute("phat = 0.62");
$ans2 = Compute("pi = 0.5");
$ans3 = Compute("pi > 0.5");

BEGIN_PGML
# Answer checker allows incorrect variable names #

+ Observed sample statistic (correct answer [$ans1]) [_____________] Try
entering [| pi = 0.62 |] instead.
+ Null hypothesis (correct answer [$ans2]) [_____________] Try entering [| phat
= 0.5 |] instead.
+ Alternative hypothesis (correct answer [$ans3]) [_____________]  Try entering
[| phat > 0.5 |] instead.

---
END_PGML

ANS( $ans1->cmp, $ans2->cmp, $ans3->cmp );

########################################

Context("Inequalities");
Context()->constants->remove('pi');
Context()->variables->are('phat'=>['Real','TeX'=>'\widehat{p}']);

$ans4 = Compute("phat = 0.62");

Context("Inequalities");
Context()->constants->remove('pi');
Context()->variables->are('pi'=>['Real','TeX'=>'\pi']);

$ans5 = Compute("pi = 0.5");
$ans6 = Compute("pi > 0.5");

BEGIN_PGML
# Kludgy fix #

With this fix, when students enter the wrong variable name, they get a message
saying that the variable is undefined in this context.

+ Observed sample statistic (correct answer [$ans4]) [_____________] Try
entering [| pi = 0.62 |] instead.
+ Null hypothesis (correct answer [$ans5]) [_____________] Try entering [| phat
= 0.5 |] instead.
+ Alternative hypothesis (correct answer [$ans6]) [_____________]  Try entering
[| phat > 0.5 |] instead.
END_PGML

ANS( $ans4->cmp, $ans5->cmp, $ans6->cmp );

ENDDOCUMENT();

-- 
Configure bugmail: http://bugs.webwork.maa.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the webwork-bugs mailing list