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

by Murphy Waggoner - Number of replies: 6### Re: Balance between student thought and careful programming in questions of the type "Find the equation of..."

by Paul Pearson -### Re: Balance between student thought and careful programming in questions of the type "Find the equation of..."

by Murphy Waggoner -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.

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

by Davide Cervone -*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.

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.

*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.

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.