|
2 | 2 | ## Complex Numbers |
3 | 3 | ## ENDDESCRIPTION |
4 | 4 |
|
5 | | -## Tagged by nhamblet |
6 | | - |
7 | 5 | ## DBsubject(Complex analysis) |
8 | 6 | ## DBchapter(Arithmetic) |
9 | 7 | ## DBsection(Powers and roots) |
10 | 8 | ## Institution(Rochester) |
11 | 9 | ## Level(2) |
| 10 | +## MO(1) |
12 | 11 | ## KEYWORDS('Complex', 'Imaginary') |
13 | 12 |
|
14 | 13 | DOCUMENT(); # This should be the first executable line in the problem. |
15 | 14 |
|
16 | 15 |
|
17 | 16 | loadMacros( |
18 | 17 | "PGstandard.pl", |
19 | | - "PGchoicemacros.pl", |
20 | | - "PGcomplexmacros.pl", |
| 18 | + "MathObjects.pl", |
| 19 | + "PGML.pl", |
21 | 20 | "PGcourse.pl" |
22 | 21 | ); |
23 | 22 |
|
24 | 23 | TEXT(beginproblem()); |
25 | 24 | $showPartialCorrectAnswers = 1; |
26 | 25 |
|
| 26 | +Context("Complex"); |
| 27 | +Context()->functions->disable('sqrt'); |
| 28 | +Context()->operators->undefine('^', '**'); |
| 29 | +Context()->{error}{msg}{"Can't use '^' in this context"} |
| 30 | + = "Exponents are disabled for this problem. Compute the result for yourself and resubmit your answer."; |
| 31 | +Context()->{error}{msg}{"Can't use '**' in this context"} |
| 32 | + = "Exponents are disabled for this problem. Compute the result for yourself and resubmit your answer."; |
| 33 | +Context()->{error}{msg}{"Function 'sqrt' is not allowed in this context"} |
| 34 | + = "Square roots are disabled for this problem. Compute the result for yourself and resubmit your answer."; |
27 | 35 |
|
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)\}. |
| 36 | +do { |
| 37 | + $z = non_zero_random(-5,5,1) + non_zero_random(-5,5,1)*i; |
| 38 | + $z2 = $z**2; |
| 39 | + } while (Re($z2) == 0); |
| 40 | +$ans = List($z,-$z); |
35 | 41 |
|
36 | | -EOT |
| 42 | +BEGIN_PGML |
| 43 | +Find the square roots of [:[$z2]:]. |
37 | 44 |
|
38 | | -$ans1 = sqrt($z); |
39 | | -$ans = Re($ans1) + Im($ans1)*i; |
40 | | -ANS(cplx_cmp($ans)); |
| 45 | +The square roots are [__________]{$ans}. |
| 46 | +END_PGML |
41 | 47 |
|
42 | 48 | ENDDOCUMENT(); # This should be the last executable line in the problem. |
43 | | - |
44 | | - |
|
0 commit comments