PREP 2014 Question Authoring - Archived

Balance between student thought and careful programming in questions of the type "Find the equation of..."

Balance between student thought and careful programming in questions of the type "Find the equation of..."

by Murphy Waggoner -
Number of replies: 6
As I look through the problem libraries I find that often the questions are leading and require less thought on part of the student.  For instance, when asking for the equation of a line, the question will just give blanks for the slope and intercept instead of asking for the equation entered as a whole.

I understand that there are costs involved in asking more from the student - costs in terms of their frustration if they don't know the right form to begin with but telling them the form reduces the critical thinking involved on their part.
Also a cost in coding to account for the variety of answers they may provide and, as was presented this morning, the issues is checking answers when done by sampling and accounting for finite/binary issues.

Where does one draw the line?  What makes a 'good' WebWork problem when the question is "Find the equation of..."
In reply to Murphy Waggoner

Re: Balance between student thought and careful programming in questions of the type "Find the equation of..."

by Paul Pearson -
Hi Murphy,

The problems in the library that ask for the slope and intercept of a line in separate answer blanks are likely 10 or more years old (pre-MathObjects).  MathObjects provide a few ways to check equations.

1. For equations that define functions (such as "y = sin(x)" or "z = e^t", which have the general form variable = formula expression), you can use the parserAssignment.pl macro:

http://webwork.maa.org/wiki/EquationDefiningFunction1
http://webwork.maa.org/pod/pg_TRUNK/macros/parserAssignment.pl.html

2. For (general) linear equations, you can use the parserImplicitPlane.pl macro, which has a very robust answer checker.  

http://webwork.maa.org/wiki/ImplicitPlane1
http://webwork.maa.org/wiki/ImplicitPlane
http://webwork.maa.org/pod/pg_TRUNK/macros/parserImplicitPlane.pl.html

3. For general equations, you can use the parserImplicitEquation.pl macro, which has a somewhat finicky answer checker since it attempts to search for solutions to the equation.

http://webwork.maa.org/wiki/EquationImplicitFunction1
http://webwork.maa.org/pod/pg_TRUNK/macros/parserImplicitEquation.pl.html

We talked about parserAssignment.pl today, and we will talk about parserImplicitPlane.pl and parserImplicitEquation.pl next Monday.  We would love to have people write questions with authentic answers that use these answer checkers (and contribute them to the Open Problem Library for others to use!).  

Moving forward, we should all try to use these wonderful macros that Davide has provided us to write questions with authentic answers.  Sure, these macros take a little time to learn, but they're every bit as quick and easy to implement as the less authentic methods (especially when you've got templates to copy from and good documentation to refer to).

With regards to student frustration, I would say from my experience that as long as you clearly communicate the type of answer (equation) and provide help links for that type of answer (help (equation) provided by AnswerFormatHelp.pl), students quickly learn what to do and don't complain much.

Best regards,

Paul Pearson
In reply to Paul Pearson

Re: Balance between student thought and careful programming in questions of the type "Find the equation of..."

by Murphy Waggoner -
I agree about the authentic answers.

I put a problem on the Problem Testing problem set (problem 5 there unless someone renumbers them) that uses parserImplicitPlane.pl. The current source code is below.

I'm struggling with a similar problem that is not linear (a circle). I'll see if I can get it to work and post as well.

I'm not real excited about the error message from parserImplicitPlane.pl when the student doesn't enter an equation. In response to x - y I get "Your answer isn't an implicit plane (it looks like a formula that returns a number)." Since I am using this for lines, I guess I'd rather be able to have a message to that effect.

## DESCRIPTION
## Complex Variables
## ENDDESCRIPTION

## KEYWORDS('Complex')
## Tagged by mewaggoner

## DBsubject('Complex Analysis')
## DBchapter('Complex Variables')
## DBsection('Point Sets')
## Date('22Jun2014')
## Author('Murphy Waggoner')
## Institution('Simpson')


DOCUMENT(); # This should be the first executable line in the problem.

######################################
# Preamble

loadMacros(
"PG.pl",
"PGbasicmacros.pl",
"MathObjects.pl",
"PGchoicemacros.pl",
"PGanswermacros.pl",
"PGauxiliaryFunctions.pl",
"PGcomplexmacros.pl",
"parserImplicitPlane.pl" # to allow input of linear equations
);

TEXT(beginproblem());

######################################
# Setup

Context("ImplicitPlane");
Context()->variables->are(x=>"Real",y=>"Real");
Context()->variables->add(z => "Complex");
Context()->variables->add(i => "Complex");

# Generate some random numbers to use below

$x1 = non_zero_random( -3, 3, 1 );
$y1 = non_zero_random( -3, 3, 1 );
$r1 = 1; #RHS of the complex equation


# Create the LHS of the equation of complex variables
# and make it pretty

$f1 = Compute("abs((z - $x1 - $y1 i)/z)")->reduce->TeX;

######################################
# Calculate Solutions
# The Cartesian equation of a plane


$soln1 = ImplicitPlane("2*$y1*y=(-2*$x1)*x + $x1*$x1 + $y1*$y1 ");


######################################
# Question text

BEGIN_TEXT

Convert the following equation in the complex variable \(z\) to an equation in real variables \(x\) and \(y\).

$BR



$PAR
The complex equation \( $f1 = $r1\) describes the same set of points as the real equation
$BR
\{ans_rule(20)\}




$PAR
END_TEXT

######################################
# End game

#Checking solutions
ANS($soln1->cmp);


#Show the students which answers were correct
$showPartialCorrectAnswers = 1;

######################################
# Done

ENDDOCUMENT(); # This should be the last executable line in the problem.

In reply to Murphy Waggoner

Re: Balance between student thought and careful programming in questions of the type "Find the equation of..."

by Davide Cervone -
The word that the ImplicitPlane object uses for the type of answer that is expected depends on the number of variables in the context. If it is two variables, it is called an implicit line, and if three or more, an implicit plane. Note that it is not the number of variables in the equation, since in (x,y,z)-space, you would still want x+y=1 and y=3 to be referred to as planes, not lines or points.

In your case, you have variables x and y, and then add z and i. That makes for four variables, so it is called a plane.

There are a couple of ways around this. Firs, since your z and i are only used to display the original equation, you could use a separate context for that (the Complex context, so you don't have to add the variables). For example,

Context("ImplicitPlane");
Context()->variables->are(x=>"Real",y=>"Real");

$x1 = non_zero_random( -3, 3, 1 ); 
$y1 = non_zero_random( -3, 3, 1 ); 
$r1 = 1; #RHS of the complex equation 

$soln1 = ImplicitPlane("2*$y1*y=(-2*$x1)*x + $x1*$x1 + $y1*$y1 ");

Context("Complex");

$f1 = Compute("abs((z - $x1 - $y1 i)/z)")->reduce->TeX;

On the other hand, this will mean that if the student enters z or i in the answer, she will get an error message about unknown variables. If you want to have z and i be known in the answer blank, then a solution is to create the ImplicitPlane object first before adding the variables to the context. The name is determined at the time the object is created, so if there are only two at that point, it will be called a line.

Context("ImplicitPlane");
Context()->variables->are(x=>"Real",y=>"Real");

$x1 = non_zero_random( -3, 3, 1 ); 
$y1 = non_zero_random( -3, 3, 1 ); 
$r1 = 1; #RHS of the complex equation 

$soln1 = ImplicitPlane("2*$y1*y=(-2*$x1)*x + $x1*$x1 + $y1*$y1 ");

Context()->variables->add(z=>'Complex');
Context()->constants->redefine(i=>{from=>"Complex"});

$f1 = Compute("abs((z - $x1 - $y1 i)/z)")->reduce->TeX;

Another possibility is simply to set the name used for the object yourself:

  ANS($soln1->cmp(cmp_class=>"an Implicit Line"));
or
$soln1 = ImplicitPlane("2*$y1*y=(-2*$x1)*x + $x1*$x1 + $y1*$y1 ")->with(implicit=>"line");
to set the type on the object itself.

Hope one of these does the trick.

In reply to Davide Cervone

Re: Balance between student thought and careful programming in questions of the type "Find the equation of..."

by Murphy Waggoner -
Thanks for the suggestions about the question I posted about linear equations. I made the changes and the error message is better now. Also helped me with some other problems I was having in other questions as well. Very useful.

Below is the new code. I assumed I would have to go back to the ImplicitPlane context for the student input, so instead of changing context twice, I started with Complex.

I'm struggling to create a similar problem with ImplicitEquation but I'll start a new post with that since this one is getting a little long and now has multiple topics.

## DESCRIPTION
## Complex Variables
## ENDDESCRIPTION

## KEYWORDS('Complex')
## Tagged by mewaggoner

## DBsubject('Complex Analysis')
## DBchapter('Complex Variables')
## DBsection('Point Sets')
## Date('22Jun2014')
## Author('Murphy Waggoner')
## Institution('Simpson')


DOCUMENT(); # This should be the first executable line in the problem.

######################################
# Preamble

loadMacros(
"PG.pl",
"PGbasicmacros.pl",
"MathObjects.pl",
"PGchoicemacros.pl",
"PGanswermacros.pl",
"PGauxiliaryFunctions.pl",
"PGcomplexmacros.pl",
"parserImplicitPlane.pl" # to allow input of linear equations
);

TEXT(beginproblem());

######################################
# Setup

# Set the context to Complex for the question - will change later

Context("Complex");

# Create some random variables to use below

$x1 = non_zero_random( -3, 3, 1 );
$y1 = non_zero_random( -3, 3, 1 );
$r1 = 1; #RHS of the complex equation

# Create the LHS of the equation of complex variables
# and make it pretty

$f1 = Compute("abs((z - $x1 - $y1 i)/z)")->reduce->TeX;

######################################
# Calculate Solutions
# The Cartesian equation of a plane

# Change context to ImplicitPlane for the solution and
# student input

Context("ImplicitPlane");
Context()->variables->are(x=>"Real",y=>"Real");

$soln1 = ImplicitPlane("2*$y1*y=(-2*$x1)*x + $x1*$x1 + $y1*$y1 ");


######################################
# Question text

BEGIN_TEXT

Convert the following equation in the complex variable \(z\) to an equation in real variables \(x\) and \(y\).

$BR


$PAR
The complex equation \( $f1 = $r1\) describes the same set of points as the real equation
$BR
\{ans_rule(20)\}

$PAR
END_TEXT

######################################
# End game

#Checking solutions
ANS($soln1->cmp);

#Show the students which answers were correct
$showPartialCorrectAnswers = 1;

######################################
# Done

ENDDOCUMENT(); # This should be the last executable line in the problem.

In reply to Murphy Waggoner

Re: Balance between student thought and careful programming in questions of the type "Find the equation of..."

by Davide Cervone -
I assumed I would have to go back to the ImplicitPlane context for the student input, so instead of changing context twice, I started with Complex.

The context used by the answer checker is the one in effect when the MathObject was created, not the one that is active during the ANS() call. So it doesn't matter which order you make your original complex and implicit plane objects. They keep their contexts and use them during the answer evaluation.

I'm struggling to create a similar problem with ImplicitEquation

The ImplicitEquation object is very finicky, and should be avoided if another method can be used. But it can be made to work if you are careful.
In reply to Murphy Waggoner

Re: Balance between student thought and careful programming in questions of the type "Find the equation of..."

by Davide Cervone -
I think Paul's answer for why some problems ask for slope and intercept separately is probably right. In the earlier days of WeBWorK (now nearly 20 years old), there were far fewer options for asking "authentic" answers, and so some problems where written in a fairly convoluted way. One had to do things like "The roots of f(x) are x = [___] and x = [___] (list the smallest one first", or "The equation is A x + B y = 0 where A = [___] and B = [___]". These could be written in a more natural way now, but back then this was the only way to do it. These problems are in the library, and people do still use them. Moreover, people sometimes use them as templates for the new problems they write, which is too bad. That is why we are trying to help you all to learn the more sophisticated ways of writing problem (and you will go out and help others at your institutions do the same). We also have people going through the library to reduce the duplications and improve the problems, but it is an enormous task.

I do think that one of the things that needs to be worked on for the future is a means of using crowd sourcing to evaluate the problems in the library. We've talked about a number of schemes for doing that, but it is still in the future.