[npl] / trunk / NationalProblemLibrary / Rochester / setLinearAlgebra21InnerProductSpaces / ur_la_21_3.pg Repository:
ViewVC logotype

View of /trunk/NationalProblemLibrary/Rochester/setLinearAlgebra21InnerProductSpaces/ur_la_21_3.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 198 - (download) (annotate)
Tue May 2 20:24:19 2006 UTC (7 years ago) by jjholt
File size: 2003 byte(s)
Update tags.

    1 ## DESCRIPTION
    2 ## Linear Algebra
    3 ## ENDDESCRIPTION
    4 
    5 ## KEYWORDS ('linear algebra','vector space','inner product','dot product')
    6 ## Tagged by cmd6a 4/30/06
    7 
    8 ## DBsubject('Linear Algebra')
    9 ## DBchapter('Vector Spaces')
   10 ## DBsection('Inner Product')
   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 
   22 loadMacros(
   23 "PG.pl",
   24 "PGbasicmacros.pl",
   25 "PGchoicemacros.pl",
   26 "PGanswermacros.pl",
   27 "PGgraphmacros.pl",
   28 "PGmatrixmacros.pl",
   29 "PGnumericalmacros.pl",
   30 "PGauxiliaryFunctions.pl"
   31 );
   32 
   33 TEXT(beginproblem());
   34 $showPartialCorrectAnswers = 1;
   35 
   36 $A = new Matrix(3,2);
   37 $B = new Matrix(3,2);
   38 
   39 foreach my $i (1..3) {
   40         foreach my $j (1..2) {
   41                 $A->assign($i,$j, non_zero_random(-3,3,1));
   42     $B->assign($i,$j, non_zero_random(-3,3,1));
   43         }
   44 }
   45 
   46 $AT = new Matrix(2,3);
   47 $BT = new Matrix(2,3);
   48 
   49 $AT->transpose($A);
   50 $BT->transpose($B);
   51 
   52 $AB = $AT * $B;
   53 $prod = $AB->element(1,1) + $AB->element(2,2);
   54 
   55 $A2 = $AT * $A;
   56 $norm_a = sqrt($A2->element(1,1) + $A2->element(2,2));
   57 
   58 $B2 = $BT * $B;
   59 $norm_b = sqrt($B2->element(1,1) + $B2->element(2,2));
   60 
   61 $alpha = arccos($prod / $norm_a / $norm_b);
   62 
   63 BEGIN_TEXT
   64 
   65 If \(A\) and \(B\) are arbitrary \( m\times n \) matrices, then the mapping \( <A,B>= {\rm trace}(A^T B) \)
   66 defines an inner product in \( {\mathbb R}^{m\times n} \).
   67 $BR
   68 Use this inner product to find \( <A,B>\), the norms
   69 \( ||A|| \) and \( ||B|| \), and the angle \( \alpha_{A,B}\) between \(A\) and \(B\) for
   70 $BR
   71 \{ mbox( '\(A=\)', display_matrix($A), 'and \(B=\)', display_matrix($B), '.' ) \}
   72 $BR
   73 \( <A,B>=\) \{ans_rule(20)\},
   74 $BR
   75 \( ||A||=\) \{ans_rule(20)\},
   76 $BR
   77 \( ||B||=\) \{ans_rule(20)\},
   78 $BR
   79 \( \alpha_{A,B}=\) \{ans_rule(20)\}.
   80 
   81 END_TEXT
   82 
   83 ANS(num_cmp($prod));
   84 ANS(num_cmp($norm_a));
   85 ANS(num_cmp($norm_b));
   86 ANS(num_cmp($alpha));
   87 
   88 ENDDOCUMENT();       # This should be the last executable line in the problem.
   89 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9