Skip to content

Commit 790058f

Browse files
committed
Rewrite problem with MathObjects,PGML in order to disallow use of sqrt
1 parent f6a75ab commit 790058f

File tree

1 file changed

+15
-17
lines changed
  • OpenProblemLibrary/Rochester/setAlgebra11ComplexNumbers

1 file changed

+15
-17
lines changed

OpenProblemLibrary/Rochester/setAlgebra11ComplexNumbers/Sqrt.pg

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,41 @@
22
## Complex Numbers
33
## ENDDESCRIPTION
44

5-
## Tagged by nhamblet
6-
75
## DBsubject(Complex analysis)
86
## DBchapter(Arithmetic)
97
## DBsection(Powers and roots)
108
## Institution(Rochester)
119
## Level(2)
10+
## MO(1)
1211
## KEYWORDS('Complex', 'Imaginary')
1312

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

1615

1716
loadMacros(
1817
"PGstandard.pl",
19-
"PGchoicemacros.pl",
20-
"PGcomplexmacros.pl",
18+
"MathObjects.pl",
19+
"PGML.pl",
2120
"PGcourse.pl"
2221
);
2322

2423
TEXT(beginproblem());
2524
$showPartialCorrectAnswers = 1;
2625

26+
Context("Complex");
27+
Context()->functions->disable('sqrt');
28+
Context()->operators->undefine('^');
2729

28-
$z = random(-9,9,1) + non_zero_random(-9,9,1)*i;
29-
30-
TEXT(EV2(<<EOT));
31-
Find the square root of $z so that the real part of your answer is
32-
positive.
33-
$BR $BR
34-
The square root is \{ans_rule(10)\}.
30+
do {
31+
$z = non_zero_random(-5,5,1) + non_zero_random(-5,5,1)*i;
32+
$z2 = $z**2;
33+
} while (Re($z2) == 0);
34+
$ans = List($z,-$z);
3535

36-
EOT
36+
BEGIN_PGML
37+
Find the square roots of [:[$z2]:].
3738

38-
$ans1 = sqrt($z);
39-
$ans = Re($ans1) + Im($ans1)*i;
40-
ANS(cplx_cmp($ans));
39+
The square roots are [__________]{$ans}.
40+
END_PGML
4141

4242
ENDDOCUMENT(); # This should be the last executable line in the problem.
43-
44-

0 commit comments

Comments
 (0)