Hi,

I have created a problem where the answer is a list of points, but I would also like to force the answers to be entered as fractions. I have tried to use the two contexts Fraction-NoDecimals and Point (can I do this?) but it is not working, i.e. decimal answers are still accepted. Any ideas how I can fix this?

Charles

PS Here is my problem

# DESCRIPTION

# Solve a system of equation involving a product

# WeBWorK problem written by Charles Fortin,

# <cfortin(at)champlaincollege.qc.ca(dot)ca>

# ENDDESCRIPTION

## DBsubject('WeBWorK')

## DBchapter('Demos')

## DBsection('Problem')

## KEYWORDS('')

## TitleText1('')

## EditionText1('')

## AuthorText1('')

## Section1('')

## Problem1('')

## Author('Charles Fortin')

## Institution('ChamplainCollege')

DOCUMENT();

loadMacros(

"PGstandard.pl",

"MathObjects.pl",

"PGchoicemacros.pl",

"contextFraction.pl",

"contextLimitedPoint.pl",

"AnswerFormatHelp.pl"

);

# This problem requires the student to solve

# xy=h; (x-k)*(y-l)=q;

# The solutions are solutions of the equation

# lx^2+(q-kl-h) + kh=0

# Since lkh = mn and q-kl-h=m+n, the quadratic

# on the left-hand side can be factored as

# 1/l(lx+m)(lx+h)

# make sure we're in the context we want

Context("Fraction-NoDecimals");

Context()->strings->add(none=>{});

$l = random(1,3);

$k = random(1,3);

$h = random(1,3);

$m = Compute("$l*$k");

$n = Compute("$h");

$q = Compute("2*($m+$n)");

$ans1x = Compute("-$m/$l");

$ans1y = Compute("-($h*$l)/$m");

$ans2x = Compute("-$h/$l");

$ans2y = Compute("-$l");

Context("Point");

$answer = List( Point("($ans1x,$ans1y)"), Point("($ans2x,$ans2y)") );

TEXT(beginproblem());

Context()->texStrings;

BEGIN_TEXT

Solve the system of equations

\[\left\lbrace

\begin{array}{ccc}

xy &=& $h \\

(x-$k)(y-$l) &=& $q

\end{array}

\right.\]

Enter a solution as \( (x,y) \),

including the parentheses. If there is more

than one correct answer, enter a comma

separated list of points. If there are no answer, enter

${BBOLD}none$EBOLD.

$BR

$BCENTER

(x,y): \{ ans_rule(20) \}

\{ AnswerFormatHelp("points") \}

$ECENTER

END_TEXT

Context()->normalStrings;

ANS($answer->cmp() );

Context()->texStrings;

SOLUTION(EV3(<<'END_SOLUTION'));

$PAR SOLUTION $PAR

END_SOLUTION

Context()->normalStrings;

ENDDOCUMENT();

Context()->parens->set('('=>{type=>'Point'});

$answer = Compute("($ans1x,$ans1y),($ans2x,$ans2y)" );

After making this change, the problem almost works. It accepts correct answer and rejects any with decimals, all the while giving the right feedback messages.

I get a pink screen though and error messages saying that there is something wrong with the constants i, j, and k. I'm not sure how to address that. Maybe someone else knows?

I would guess that one of these things is the source of my pink screen. I literally copied and pasted Charles's code and replaced the two lines as in my post.

Charles