[npl] / trunk / NationalProblemLibrary / ASU-topics / setComplexNumbers / zhu8.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

View of /trunk/NationalProblemLibrary/ASU-topics/setComplexNumbers/zhu8.pg

Thu Jul 19 21:11:19 2007 UTC (5 years, 10 months ago) by jjholt
File size: 1498 byte(s)
```Updated/Consolidated tags.
```

```    1 ## DESCRIPTION
2 ## Imaginary Roots of Quadratics
3 ## ENDDESCRIPTION
4
5 ## KEYWORDS('complex', 'imaginary', 'quadratic', 'root')
6 ## Tagged by YL
7
8 ## DBsubject('Calculus')
9 ## DBchapter('Complex Variables')
10 ## DBsection('Complex Numbers')
11 ## Date('')
12 ## Author('')
13 ## Institution('ASU')
14 ## TitleText1('Calculus: Early Transcendentals')
15 ## EditionText1('5')
16 ## AuthorText1('Stewart')
17 ## Section1('G')
18 ## Problem1('')
19
20 ## TitleText2('Calculus: Early Transcendentals')
21 ## EditionText2('6')
22 ## AuthorText2('Stewart')
23 ## Section2('G')
24 ## Problem2('')
25
26 DOCUMENT();        # This should be the first executable line in the problem.
27
29 "PG.pl",
30 "PGbasicmacros.pl",
31 "PGchoicemacros.pl",
33 "PGauxiliaryFunctions.pl",
34 "PGasu.pl",
36 "PGcomplexmacros.pl"
37 );
38
39 TEXT(beginproblem());
41
42 \$b =  non_zero_random(-4,4,1);
43 \$c =  random(5,8,1);
44
45 \$p=nicestring([1,\$b,\$c]);
46
47 TEXT(EV2(<<EOT));
48 Find all solutions of the equation \( \$p = 0\) and
49 express them in the form \(a + b i\):
50 \$BR \$BR
51 First input the solution with \(b <0\) here:
52 \$BR
53
54  \{ans_rule(25) \}
55 \$BR
56 Then input the solution with \(b > 0\) here:
57 \$BR
58
59  \{ans_rule(25) \}
60 \$BR
61 EOT
62
63 \$nb=-\$b;
64 \$delta=-\$b**2+4*\$c;
65 \$ans1 = \$nb/2;
66 \$ans2 = (\$delta)**0.5/2;
67 \$ans3 = \$nb/2;
68 \$ans4 = (\$delta)**0.5/2;
69
70 ANS(number_list_cmp("\$ans1-\$ans2 i",complex=>'ok'));
71
72 ANS(number_list_cmp("\$ans3+\$ans4 i",complex=>'ok'));
73
74
75 ENDDOCUMENT();        # This should be the last executable line in the problem.
76
```