I'm working on a problem that gives the student an equation of the form

(x-h)^2 + (y-k)^2 = r^2

and asks the student to enter one of the form

abs(z-(h+ki)) = r,

using two blanks separated by an equals sign. I would like the student to be able

to enter the answers in either order, which presently doesn't work, but I can

live with that. The problem seems to work fine otherwise. However, it is

throwing some errors I haven't been able to figure out. Here is the source; I paste the errors after. Thanks for any insight you can give.

-Dave

##DESCRIPTION

## Find a complex equation for a line in the plane.

##ENDDESCRIPTION

##KEYWORDS("complex", "circle")

## DBsubject("Complex analysis")

## DBchapter("Elementary functions")

## DBsection("Polynomials and rational functions")

## Date("01/10/2014")

## Author("Dave Rosoff")

## Institution("College of Idaho")

## TitleText1("Geometry")

## EditionText1("1")

## AuthorText1("Hitchman")

## Section1("4.2")

## Problem1("1")

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

DOCUMENT();

loadMacros(

"PGstandard.pl", # Standard macros for PG language

"MathObjects.pl",

"parserMultiAnswer.pl",

"PGML.pl",

#"source.pl", # allows code to be displayed on certain sites.

#"PGcourse.pl", # Customization file for the course

);

# Print problem number and point value (weight) for the problem

TEXT(beginproblem());

# Show which answers are correct and which ones are incorrect

$showPartialCorrectAnswers = 1;

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

#

# Setup

#

#

Context("Numeric");

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

$h = non_zero_random(-10,10);

$k = non_zero_random(-10,10);

$r = non_zero_random(1,7); # circle with center (h,k) and radius r

$rsq = Formula("$r^2");

$circx = Formula("x - $h")->reduce;

$circy = Formula("y - $k")->reduce; # for nice displaying

Context("Complex");

$center = Complex($h,$k);

$circz = Formula("abs(z - ($center))");

$multians = MultiAnswer($circz, $r)->with(

checkTypes => 0,

singleResult => 1,

checker => sub {

my ( $correct, $student, $self ) = @_;

my ( $f1stu, $f2stu ) = @{$student};

my ( $f1, $f2 ) = @{$correct};

if ( (( (ref($f1) eq ref($f1stu)) && ($f1 == $f1stu) ) && ( (ref($f2) eq ref($f2stu)) && ($f2 == $f2stu) )) ||

(( (ref($f1) eq ref($f2stu)) && ($f1 == $f2stu) ) && ( (ref($f2) eq ref($f1stu)) && ($f2 == $f1stu) )) ) {

return [1,1];

} else {

if (( (ref($f1) eq ref($f1stu)) && ($f1 == $f1stu) ) || ( (ref($f2) eq ref($f1stu)) && ($f2 == $f1stu) )) {

return [1,0];

} elsif (( (ref($f1) eq ref($f2stu)) && ($f1 == $f2stu) ) || ( (ref($f2) eq ref($f2stu)) && ($f2 == $f2stu) )) {

return [0,1];

} else {

return [0,0];

}

}

}

);

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

#

# Text

#

#

BEGIN_PGML

Find the complex equation of the circle [`([$circx])^2 + ([$circy])^2 = [$rsq]`]. Type [`\mathrm{abs}(z)`] for [`\lvert z \rvert`].

[________]{$multians} = [________]{$multians}

END_PGML

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

#

# Answers

#

#

#ANS($multians->cmp);

ENDDOCUMENT();

This throws the following errors:

### Warning messages

`Use of uninitialized value $ans_name in hash element at /opt/webwork/pg/lib/WeBWorK/PG/Translator.pm line 1204`

`Use of uninitialized value in scalar assignment at /opt/webwork/pg/lib/WeBWorK/PG/Translator.pm line 1453`

`Use of uninitialized value $ans_name in hash element at /opt/webwork/pg/lib/WeBWorK/PG/Translator.pm line 1208`

`Use of uninitialized value $ans_name in hash element at /opt/webwork/pg/lib/WeBWorK/PG/Translator.pm line 1209`

`Use of uninitialized value $ans_name in concatenation (.) or string at /opt/webwork/pg/lib/WeBWorK/PG/Translator.pm line 1226`

`Use of uninitialized value $ans_name in hash element at /opt/webwork/pg/lib/WeBWorK/PG/Translator.pm line 1246`

`Use of uninitialized value $_ in hash element at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm line 225.`

`Use of uninitialized value $name in hash element at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm line 262.`

`Use of uninitialized value $_ in concatenation (.) or string at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm line 1637.`