[npl] / trunk / NationalProblemLibrary / Rochester / setLinearAlgebra11Eigenvalues / ur_la_11_16.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

View of /trunk/NationalProblemLibrary/Rochester/setLinearAlgebra11Eigenvalues/ur_la_11_16.pg

Tue May 2 20:24:19 2006 UTC (7 years ago) by jjholt
File size: 2025 byte(s)
```Update tags.
```

```    1 ## DESCRIPTION
2 ## Linear Algebra
3 ## ENDDESCRIPTION
4
5 ## KEYWORDS ('linear algebra','matrix','eigenvalue')
6 ## Tagged by cmd6a 4/30/06
7
8 ## DBsubject('Linear Algebra')
9 ## DBchapter('Matrices')
10 ## DBsection('Eigenvalues')
11 ## Date('')
12 ## Author('')
13 ## Institution('Rochester')
14 ## TitleText1('')
15 ## EditionText1('')
16 ## AuthorText1('')
17 ## Section1('')
18 ## Problem1('')
19
20 DOCUMENT();        # This should be the first executable line in the problem.
21
23 "PG.pl",
24 "PGbasicmacros.pl",
25 "PGchoicemacros.pl",
27 "PGgraphmacros.pl",
28 "PGmatrixmacros.pl",
29 "PGnumericalmacros.pl",
30 "PGauxiliaryFunctions.pl",
31 "PGmorematrixmacros.pl"
32 );
33
34 TEXT(beginproblem());
36
37 \$a = non_zero_random(-2,2,1);
38 \$e = random(1,2,1) + 3*random(-1,1,1) - \$a;
39 \$b = random(-1,1,2);
40 \$sqrD = random(1,2,1) + 3*random(0,2,1);
41 \$D = \$sqrD**2;
42 \$d = (\$D - (\$a+\$e)**2)*\$b/3 + \$a*\$e*\$b;
43
44 # characteristic polynomial is - (lambda^3 - (a+e)lambda^2 + (ae-bd)lambda - b^2k)
45 # now forget about the minus in front
46 # we want 3 distinct real roots, so we want local max and min with pos and neg values respectively
47 # find max and min:
48 # derivative is 3lamda^2 - 2(a+e)lambda + (ae-bd)
49 # need 2 disctinct real roots
50 # discriminant/4 is (a+e)^2 - 3ae + 3bd = (a+e)^2 - 3ae + D - (a+e)^2 + 3ae = D
51 # ok, the discriminant is positive
52 # roots are
53
54 \$max_root = (\$a + \$e + \$sqrD)/3;
55 \$min_root = (\$a + \$e - \$sqrD)/3;
56
57 # local max and min values of the cubic polynomial (without the minus in front) have to be pos and neg, so
58
59 \$ans_min = \$max_root**3 - (\$a+\$e)*\$max_root**2 + (\$a*\$e - \$b*\$d)*\$max_root;
60 \$ans_max = \$min_root**3 - (\$a+\$e)*\$min_root**2 + (\$a*\$e - \$b*\$d)*\$min_root;
61
62 BEGIN_TEXT
63
64 \{ mbox( 'The matrix \(A=\)', display_matrix([[\$a, \$b, 0], [\$d, \$e, \$b], ['k', 0, 0]]) )\}
65 \$BR
66 has three distinct real eigenvalues if and only if
67 \$BR
68 \{ans_rule(20)\} \( < k < \) \{ans_rule(20)\}.
69
70 END_TEXT
71
72 ANS(num_cmp(\$ans_min));
73 ANS(num_cmp(\$ans_max));
74
75 ENDDOCUMENT();       # This should be the last executable line in the problem.
76
```