[npl] / trunk / NationalProblemLibrary / ASU-topics / set119MatrixAlgebra / p13.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# View of /trunk/NationalProblemLibrary/ASU-topics/set119MatrixAlgebra/p13.pg

Sat Jun 3 14:35:45 2006 UTC (6 years, 11 months ago) by gage
File size: 2483 byte(s)
 Cleaned code with convert-functions.pl script


    1 ## DESCRIPTION
2 ## Matrix Algebra
3 ## ENDDESCRIPTION
4
5 ## KEYWORDS('Algebra' 'Matrix' 'Matrices' 'Inverse')
6 ## Tagged by tda2d
7
8 ## DBsubject('Linear Algebra')
9 ## DBchapter('Matrices')
10 ## DBsection('The Inverse of a Matrix')
11 ## Date('')
12 ## Author('')
13 ## Institution('ASU')
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 "PGasu.pl",
24 "PG.pl",
25 "PGbasicmacros.pl",
26 "PGchoicemacros.pl",
28 "PGauxiliaryFunctions.pl",
29 "PGmatrixmacros.pl"
30 );
31
32 TEXT(beginproblem());
33 $showPartialCorrectAnswers = 1; 34 35$a = non_zero_random(-6,6,1);
36 $b = non_zero_random(-5,5,1); 37$c = non_zero_random(-4,4,1);
38 do {$d = random(-9,9,2);} until (($a * $d -$b * $c) != 0); 39 40$B11 = non_zero_random(-3,3,1);
41 $B21 = non_zero_random(-3,3,1); 42 43 do {$B12 = non_zero_random(-3,3,1);} until ($B12 !=$B11);
44 $B22 = non_zero_random(-4,4,1); 45 46$det = $a *$d - $b *$c;
47
48 $ans11 =$d / $det; 49$ans12 = - $b /$det;
50 $ans21 = -$c / $det; 51$ans22 = $a /$det ;
52
53 $x1 =$ans11*$B11+$ans12*$B21; 54$y1 = $ans21*$B11+$ans22*$B21;
55
56 $x2 =$ans11*$B12+$ans12*$B22; 57$y2 = $ans21*$B12+$ans22*$B22;
58
59 $ls1 = nicestring([$a,$b],['x','y']); 60$ls2 = nicestring([$c,$d],['x','y']);
61
62
63 BEGIN_TEXT
64 Consider the following two systems.
65 $BR 66 (a) 67 $\left\{"\{"\} \begin{array}{ccc} 68 ls1 &=& B11 \\ 69 ls2 &=& B21 70 \end{array} \right.$ 71$BR
72 (b)
73 $\left\{"\{"\} \begin{array}{ccc} 74 ls1 &=& B12 \\ 75 ls2 &=& B22 76 \end{array} \right.$
77 $BR 78 (i) Find the inverse of the (common) coefficient matrix of the two systems. 79$BR
80 BCENTER 81 \{ mbox( 82 '$$A^{-1} =$$', 83 display_matrix([[ans_rule(10),ans_rule(10)], 84 [ans_rule(10),ans_rule(10)]], 85 'align'=>"cc")) \} 86ECENTER
87
88 $BR 89 (ii) Find the solutions to the two systems by using the inverse, i.e. by evaluating 90 $$A^{-1} B$$ where $$B$$ represents the right hand side (i.e. 91 $$B = \left[ \begin{array}{c} B11 \\ B21 \end{array} \right]$$ for system (a) and 92 $$B = \left[ \begin{array}{c} B12 \\ B22 \end{array} \right]$$ for system (b)). 93$BR
94 Solution to  system (a):  $$x =$$ \{ ans_rule(10)\} , $$y$$ =\{ ans_rule(10) \}
95 $BR 96 Solution to system (b): $$x =$$ \{ans_rule(10)\} , $$y$$ =\{ans_rule(10)\} 97 98 END_TEXT 99 100 ANS(num_cmp($ans11));
101 ANS(num_cmp($ans12)); 102 ANS(num_cmp($ans21));
103 ANS(num_cmp($ans22)); 104 ANS(num_cmp($x1));
105 ANS(num_cmp($y1)); 106 ANS(num_cmp($x2));
107 ANS(num_cmp(\$y2));
108
109
110
111
112 ENDDOCUMENT();       # This should be the last executable line in the problem.