[npl] / branches / UGA / 9.1.2.pg Repository:
ViewVC logotype

View of /branches/UGA/9.1.2.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1458 - (download) (annotate)
Sat Jul 24 17:11:33 2010 UTC (2 years, 9 months ago) by ted shifrin
File size: 5135 byte(s)
Log message

    1 ## DESCRIPTION
    2 ## Linear Algebra
    3 ## ENDDESCRIPTION
    4 
    5 ## KEYWORDS ('linear algebra','vector space','linear transformation')
    6 
    7 ## DBsubject('Multivariable Mathematics')
    8 ## DBchapter('Linear Transformations')
    9 ## DBsection('Change of Basis')
   10 ## Date('')
   11 ## Author('Shifrin')
   12 ## Institution('UGA')
   13 ## TitleText1('')
   14 ## EditionText1('')
   15 ## AuthorText1('')
   16 ## Section1('')
   17 ## Problem1('')
   18 
   19 DOCUMENT();        # This should be the first executable line in the problem.
   20 
   21 loadMacros(
   22 "PG.pl",
   23 "PGbasicmacros.pl",
   24 "PGchoicemacros.pl",
   25 "PGanswermacros.pl",
   26 "PGmatrixmacros.pl",
   27 "PGmorematrixmacros.pl",
   28 "weightedGrader.pl",
   29 "MathObjects.pl",
   30 "PGauxiliaryFunctions.pl",
   31 );
   32 
   33 
   34 TEXT(beginproblem());
   35 $showPartialCorrectAnswers = 1;
   36 
   37 install_weighted_grader();
   38 
   39 Context("Numeric")->variables->are(x=>'Real', y=>'Real', z=>'Real');
   40 
   41 @normal=("1","2","2");
   42 @choice=NchooseK(3,3);
   43 $sgn[1] = 1;
   44 $sgn[2] = random(-1,1,2);
   45 $sgn[3] = random(-1,1,2);
   46 foreach $i(1..3) {$a[$i]=$sgn[$i]*@normal[@choice[$i-1]]};
   47 
   48 $g=Formula("$a[1]x+$a[2]y+$a[3]z")->reduce;
   49 
   50 $M = new Matrix(3,3);
   51 $R = new Matrix(3,3);
   52 $M -> assign(1,1,1); $R -> assign(1,1,1);
   53 $M -> assign(2,2,1); $R -> assign(2,2,1);
   54 $M -> assign(3,3,0); $R -> assign(3,3,-1);
   55 foreach $i(1..3) {foreach $j(1..3) {if($i!=$j) {$M -> assign($i,$j,0);
   56 $R -> assign($i,$j,0);}}}
   57 # $M -> assign(1,2,0); $M -> assign(2,1,0); $M -> assign(1,3,0); $M ->
   58 # assign(3,1,0); $M -> assign(2,3,0); $M -> assign(3,2,0);
   59 
   60 $T = new Matrix(3,3);
   61 $S = new Matrix(3,3);
   62 $denom = $a[1]**2+$a[2]**2+$a[3]**2;
   63 # $T = Matrix("[[($a[2]**2+$a[3]**2)/$denom,-$a[1]*$a[2]/$denom,-$a[1]*$a[3]   # /$denom],[-$a[1]*$a[2]/$denom,($a[1]**2+$a[3]**2)/$denom,-$a[2]*$a[3]/$denom],
   64 # [-$a[1]*$a[3]/$denom,-$a[2]*$a[3]/$denom,($a[1]**2+$a[2]**2)/$denom]]");
   65 $T -> assign(1,1,($a[2]**2+$a[3]**2)/$denom);
   66 $T -> assign(1,2,-$a[1]*$a[2]/$denom); $T -> assign(2,1,$T->element(1,2));
   67 $T -> assign(1,3,-$a[1]*$a[3]/$denom); $T -> assign(3,1,$T->element(1,3));
   68 $T -> assign(2,2,($a[1]**2+$a[3]**2)/$denom);
   69 $T -> assign(2,3,-$a[2]*$a[3]/$denom); $T -> assign(3,2,$T->element(2,3));
   70 $T -> assign(3,3,($a[1]**2+$a[2]**2)/$denom);
   71 
   72 $S -> assign(1,1,(-$a[1]**2+$a[2]**2+$a[3]**2)/$denom);
   73 $S -> assign(1,2,-2*$a[1]*$a[2]/$denom); $S -> assign(2,1,-2*$a[1]*$a[2]/$denom);
   74 $S -> assign(1,3,-2*$a[1]*$a[3]/$denom); $S -> assign(3,1,-2*$a[1]*$a[3]/$denom);
   75 $S -> assign(2,2,($a[1]**2-$a[2]**2+$a[3]**2)/$denom);
   76 $S -> assign(2,3,-2*$a[2]*$a[3]/$denom); $S -> assign(3,2,-2*$a[2]*$a[3]/$denom);
   77 $S -> assign(3,3,($a[1]**2+$a[2]**2-$a[3]**2)/$denom);
   78 
   79 Context()->texStrings;
   80 BEGIN_TEXT
   81 
   82 Consider the \(2\)-dimensional subspace \(\mathcal P\subset\mathbb R^3\) defined by
   83 \[ $g = 0 .\]
   84 $PAR
   85 (a) Give a basis \(\mathcal B = \lbrace \mathbf v_1,\mathbf v_2,\mathbf v_3 \rbrace \) so that \(\mathbf v_1,\mathbf v_2\) span the plane \(\mathcal P\) and \(\mathbf v_3\) is orthogonal to it.
   86 $BR
   87 \{mbox('\(\mathbf v_1 = \)', ans_array(3,1,8), ', \(\quad \mathbf v_2 = \)', ans_array_extension(3,1,8), ', \(\quad \mathbf v_3 = \)', ans_array(3,1,8), '.') \}
   88 $PAR
   89 (b) Let \(T\colon \mathbb R^3\to\mathbb R^3\) be the linear transformation defined by projecting onto the plane. Give the matrix representing \(T\) with respect to the basis \(\mathcal B\).
   90 $BR
   91 \{mbox('\([T]_{\mathcal B} = \)', answer_matrix(3,3,3), '.')\}
   92 $PAR
   93 (c) Use the change-of-basis formula to calculate the standard matrix of \(T\):
   94 $BR
   95 \{mbox ( '\([T] = \)', answer_matrix(3,3,8), '.') \}
   96 (d) Now let \(S\colon \mathbb R^3\to\mathbb R^3\) be the linear transformation defined by reflecting across the plane \(\mathcal P\). Give the matrix representing \(S\) with respect to the basis \(\mathcal B\).
   97 $BR
   98 \{mbox('\([S]_{\mathcal B} = \)', answer_matrix(3,3,3), '.')\}
   99 $PAR
  100 (e) Use the change-of-basis formula to calculate the standard matrix of \(S\):
  101 $BR
  102 \{mbox ( '\([S] = \)', answer_matrix(3,3,8), '.') \}
  103 
  104 END_TEXT
  105 
  106 Context("Vector");
  107 WEIGHTED_ANS(basis_cmp([[$a[3],0,-$a[1]],[0,$a[3],-$a[2]]]),7);
  108 WEIGHTED_ANS(basis_cmp([[$a[1],$a[2],$a[3]]]),3);
  109 WEIGHTED_ANS(num_cmp($M->element(1,1)),1,num_cmp($M->element(1,2)),1,num_cmp($M->element(1,3)),1,num_cmp($M->element(2,1)),1,num_cmp($M->element(2,2)),1,num_cmp($M->element(2,3)),1,num_cmp($M->element(3,1)),1,num_cmp($M->element(3,2)),1,num_cmp($M->element(3,3)),1);
  110 WEIGHTED_ANS(num_cmp($T->element(1,1)),4,num_cmp($T->element(1,2)),4,num_cmp($T->element(1,3)),4,num_cmp($T->element(2,1)),4,num_cmp($T->element(2,2)),4,num_cmp($T->element(2,3)),4,num_cmp($T->element(3,1)),4,num_cmp($T->element(3,2)),4,num_cmp($T->element(3,3)),4);
  111 WEIGHTED_ANS(num_cmp($R->element(1,1)),1,num_cmp($R->element(1,2)),1,num_cmp($R->element(1,3)),1,num_cmp($R->element(2,1)),1,num_cmp($R->element(2,2)),1,num_cmp($R->element(2,3)),1,num_cmp($R->element(3,1)),1,num_cmp($R->element(3,2)),1,num_cmp($R->element(3,3)),1,);
  112 WEIGHTED_ANS(num_cmp($S->element(1,1)),4,num_cmp($S->element(1,2)),4,num_cmp($S->element(1,3)),4,num_cmp($S->element(2,1)),4,num_cmp($S->element(2,2)),4,num_cmp($S->element(2,3)),4,num_cmp($S->element(3,1)),4,num_cmp($S->element(3,2)),4,num_cmp($S->element(3,3)),4);
  113 
  114 ENDDOCUMENT();       # This should be the last executable line in the problem.
  115 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9