## PREP 2014 Question Authoring - Archived

### Got some questions written...can we set up a place for people to test out each others

by Murphy Waggoner -
Number of replies: 3
Hola (from Salta, Argentina),

I have written some questions and while I try to test them out well enough, it is always better for someone else to try to "break them".

Can we set up a problem set in the WebWork site for the class for us to post questions we have written for others to try, test, and critique?

BTW, here is the code for the question I spent the most time on. I probably didn't do things in the most efficient manner. I wanted to have 4 problems that were not the same time for each student; that is, part a for one student would be like part c for another.

Also, since there are three 'types' of problems, I didn't want the students to work by elimination; that is, that they would think that since they haven't answered with infinity yet the answer to the last one had to be infinity. So, I added a fourth question.

I want them to print "pretty" so I used both reduce and TeX (worked great!)

Enjoy.

## DESCRIPTION
## Complex Variables
## ENDDESCRIPTION

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

## DBsubject('Complex Analysis')
## DBchapter('Functions')
## DBsection('Limits')
## Date('14Jun2014')
## Author('Murphy Waggoner')
## Institution('Simpson')

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

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

"PG.pl",
"PGbasicmacros.pl",
"MathObjects.pl",
"PGchoicemacros.pl",
"PGauxiliaryFunctions.pl",
"PGcomplexmacros.pl"
);

TEXT(beginproblem());

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

Context("Complex");

# Decide which problem will have which exponent
# Create one each of exponents 0, 1 and 2 and then an extra
# Randomize 0, 1, 2 for the first three parts so that students working
# together won't both have the same type problem in part 1, etc.

$exp1 = Real(random(0, 2, 1)); do {$exp2 = random(0,2,1); } until ( $exp2 !=$exp1 );
do { $exp3 = random(0,2,1); } until ( ($exp3 != $exp1) &&($exp3 != $exp2) );$exp4 = Real(random(0, 2,1));

# Generate some random complex numbers to use below
# Choose coefficients of z to be non-zero

$a = Complex(random( -5, 5, 1 ) , random( -5, 5, 1 ) );$b = Complex( non_zero_random( -5, 5, 1 ) , random( -5, 5, 1 ) );
$c = Complex( non_zero_random( -5, 5, 1 ), 0);$d = Complex( 0, non_zero_random( -5, 5, 1) );
$e = Complex(non_zero_random(-5,5,1), random(-5,5,1));$f = Complex(random(-5, 5, 1), non_zero_random(-5,5,1));

# Create the expressions to take limits of
# The reduce eliminates 0 exponents, combines constants, etc.
# The TeX makes the fractions horizontal and eliminates * by
# creating TeX commands for the formulas

$f1 = Compute("($a z**$exp1 +$b)/($c z +$d )")->reduce->TeX;
$f2 = Compute("($a z^$exp2 +$b)/($c z +$d )")->reduce->TeX;
$f3 = Compute("($a z^$exp3 +$b)/($c z +$d )")->reduce->TeX;
$f4 = Compute("($e z^$exp4 +$f)/($a z +$c )")->reduce->TeX;

######################################
# Calculate Solutions
# If the exponent is 2, the answer is infinity (higher exponent on top)
# If the exponent is 1, the answer is the ratio of lead coerficients (same exponent on top and bottom)
# If the exponent is 0, the answer is 0 (higher exponent on bottom)
# To get 0 for an exponent of 0, instead of another elsif just multiply
# by the exponent 0 or 1

$soln1a = Formula("($a z**(-$exp1) +$b)/($c z**(-1) +$d )");
if ( $exp1 == 2) {$soln1b = Compute(infinity);}
else {$soln1b =$a/$c*$exp1;}

$soln2a = Formula("($a z^(-$exp2) +$b)/($c z^(-1) +$d )");
if ( $exp2 == 2) {$soln2b = Compute(infinity);}
else {$soln2b =$a/$c*$exp2;}

$soln3a = Formula("($a z^(-$exp3) +$b) / ($c z^(-1) +$d)");
if ( $exp3 == 2) {$soln3b = Compute(infinity);}
else {$soln3b =$a/$c*$exp3;}

$soln4a = Formula("($e z^(-$exp4) +$f)/($a z^(-1) +$c )");
if ( $exp4 == 2) {$soln4b = Compute(infinity);}
else {$soln4b =$e/$a*$exp4;}

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

BEGIN_TEXT

Rewrite each of these limits in the form required and evaluate. Use 'inf' (with no quote marks) for infinity if needed.
$PAR$PAR
Question 1: $$\displaystyle\lim_{z \to \infty}f1 \ = \ \lim_{z \to 0}{\$$\{ans_rule(20)\} $$\ = \$$

\{ans_rule(10)\}

$PAR Question 2: $$\displaystyle\lim_{z \to \infty}f2 \ = \ \lim_{z \to 0}{\$$\{ans_rule(20)\} $$\ = \$$ \{ans_rule(10)\}$PAR

Question 3: $$\displaystyle\lim_{z \to \infty} f3 \ = \ \lim_{z \to 0}{\$$\{ans_rule(20)\} $$\ = \$$

\{ans_rule(10)\}

$PAR Question 4: $$\displaystyle\lim_{z \to \infty}f4 \ = \ \lim_{z \to 0}{\$$\{ans_rule(20)\} $$\ = \$$ \{ans_rule(10)\}$PAR

$PAR END_TEXT ###################################### # End game #Checking solutions ANS($soln1a->cmp);
ANS($soln1b->cmp); ANS($soln2a->cmp);
ANS($soln2b->cmp); ANS($soln3a->cmp);
ANS($soln3b->cmp); ANS($soln4a->cmp);
ANS($soln4b->cmp); #Show the students which answers were correct$showPartialCorrectAnswers = 1;

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

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

### Re: Got some questions written...can we set up a place for people to test out each others

by Gavin LaRose -
Hi Murphy,

I've created a problem set called "Problem_Testing" in our course, to which people can add problems for testing.

One comment to start out here: you might want to be careful with random(-5,5,1) vs. non_zero_random(-5,5,1). In particular, it's possible for your complex variables $a, $b, $c, $d and $e to all be zero. It's unlikely, in that the variables are complex, but could cause trouble with answer checking and division by zero. Gavin In reply to Gavin LaRose ### Re: Got some questions written...can we set up a place for people to test out each others by Murphy Waggoner - Gavin, Thanks for setting up the Problem_Testing set. Also the being careful about having random variables that could be zero. I think there are two issues - one about division by zero and the other about not ending up with the type of problem you intended. I thought I had taken care of the division by zero problem by not letting$c, $d be zero. I think that I need to check Question 4 again - it was added later and I might have not chosen the denominator wisely. About the type of question I wanted, reviewing the coefficients I need to make sure that$a is not zero so that I have a z-term in the parts that I want them in.

Thanks for looking at my question for me.

Murphy