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

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

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


    1 ## DESCRIPTION
2 ## Matrix Algebra
3 ## ENDDESCRIPTION
4
5 ## KEYWORDS('Algebra' 'Matrix' 'Matrices')
6 ## Tagged by tda2d
7
8 ## DBsubject('Algebra')
9 ## DBchapter('Linear Algebra')
10 ## DBsection('Matrix Algebra')
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 "PG.pl",
24 "PGasu.pl",
25 "PGbasicmacros.pl",
26 "PGchoicemacros.pl",
28 "PGauxiliaryFunctions.pl",
29 "PGgraphmacros.pl",
30 "PGmatrixmacros.pl"
31 );
32
33 TEXT(beginproblem());
34 $showPartialCorrectAnswers = 1; 35 36$NO_SPACE = '@{}';
37
38 $a11 = non_zero_random(-10,10,1); 39$a12 = non_zero_random(-10,10,1);
40 $a21 = non_zero_random(-10,10,1); 41$a22 = random(-10,10,1);
42
43 $b11 = random(-10,10,1); 44$b12 = non_zero_random(-10,10,1);
45 $b21 = non_zero_random(-10,10,1); 46$b22 = non_zero_random(-10,10,1);
47
48 $mult = random(2,5,1); 49 50$ans11 = $mult*($a11 * $b11 +$a12 * $b21) ; 51$ans12 =$mult*($a11 * $b12 +$a12 * $b22) ; 52$ans21 = $mult*($a21 * $b11 +$a22 * $b21) ; 53$ans22 = $mult*($a21 * $b12 +$a22 * $b22) ; 54 55 56 57 BEGIN_TEXT 58 59 If 60 $A = \left[ \begin{array}{cc} 61 \{join("& ",a11,a12 ) \}\cr 62 \{join("& ",a21,a22 ) \}\cr 63 \end{array} \right] \mbox{ \ and \ \ } 64 B = \left[ \begin{array}{cc} 65 \{join("& ",b11,b12 ) \}\cr 66 \{join("& ",b21,b22 ) \}\cr 67 \end{array} \right],$ 68 69 then 70 71$BCENTER
72 \{ mbox(
73 '$$A(mult B) =$$',
74 display_matrix([[ans_rule(5),ans_rule(5)]
75 ,[ans_rule(5),ans_rule(5)]],
76 'align'=>"cc"))
77 \}
78 $ECENTER 79 END_TEXT 80 81 ANS(num_cmp($ans11));
82 ANS(num_cmp($ans12)); 83 ANS(num_cmp($ans21));
84 ANS(num_cmp(\$ans22));
85
86
87
88 ENDDOCUMENT();       # This should be the last executable line in the problem.