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

View of /branches/UGA/5.5.11.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1457 - (download) (annotate)
Sat Jul 24 17:09:50 2010 UTC (2 years, 10 months ago) by ted shifrin
File size: 2177 byte(s)
Log message

    1 ## DESCRIPTION
    2 ## Linear Algebra
    3 ## ENDDESCRIPTION
    4 
    5 ## KEYWORDS('linear algebra','vector space','basis','dot product','inner product','orthonormal')
    6 ## Tagged by cmd6a 5/3/06
    7 
    8 ## DBsubject('Linear Algebra')
    9 ## DBchapter('Vector Spaces')
   10 ## DBsection('Bases')
   11 ## Date('')
   12 ## Author('modified by Shifrin')
   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 "PGnumericalmacros.pl",
   29 "PGstatisticsmacros.pl",
   30 "PGauxiliaryFunctions.pl",
   31 "PGmatrixmacros.pl"
   32 );
   33 
   34 TEXT(beginproblem());
   35 $showPartialCorrectAnswers = 1;
   36 
   37 $a = non_zero_random(-4,4,1);
   38 $b = non_zero_random(-4,4,1);
   39 $c = non_zero_random(-3,3,1);
   40 $d = non_zero_random(-4,4,1);
   41 
   42 # create orthogonal vectors
   43 
   44 $x[1] = $a;
   45 $x[2] = $c;
   46 $x[3] = $b;
   47 $x[4] = 0;
   48 
   49 $y[1] = $b;
   50 $y[2] = 0;
   51 $y[3] = - $a;
   52 $y[4] = $d;
   53 
   54 #change the vectors so that they are no longer orthogonal but the Gram-Schmidt precess gives the original x,y.
   55 
   56 $p = random(1,3,1);
   57 $q = random(1,3,1);
   58 $k = non_zero_random(-2,2,1);
   59 
   60 $norm_x = 0;
   61 $norm_y = 0;
   62 
   63 for ($i=1; $i<5; $i++) {
   64   $cx[$i] = $p * $x[$i];
   65   $cy[$i] = $q * $y[$i] + $k * $x[$i];
   66         $norm_x = $norm_x + $x[$i] * $x[$i];
   67         $norm_y = $norm_y + $y[$i] * $y[$i];
   68 }
   69 
   70 $norm_x = sqrt($norm_x);
   71 $norm_y = sqrt($norm_y);
   72 
   73 BEGIN_TEXT
   74 
   75 Let \(\mathbf v = \{display_matrix_mm([[$cx[1]], [$cx[2]], [$cx[3]], [$cx[4]]])\}\) and \(\mathbf w = \{ display_matrix_mm([[$cy[1]], [$cy[2]], [$cy[3]], [$cy[4]]])\}\) .
   76 $BR
   77 Use the Gram-Schmidt process to determine an orthonormal basis for the subspace of \(\mathbb R^4\)
   78 spanned by \(\mathbf v\) and \(\mathbf w\).
   79 
   80 \{ mbox( answer_matrix(4,1,10), ', ', answer_matrix(4,1,10), '.'  ) \}
   81 
   82 END_TEXT
   83 
   84 ANS(num_cmp($x[1]/$norm_x));
   85 ANS(num_cmp($x[2]/$norm_x));
   86 ANS(num_cmp($x[3]/$norm_x));
   87 ANS(num_cmp($x[4]/$norm_x));
   88 
   89 ANS(num_cmp($y[1]/$norm_y));
   90 ANS(num_cmp($y[2]/$norm_y));
   91 ANS(num_cmp($y[3]/$norm_y));
   92 ANS(num_cmp($y[4]/$norm_y));
   93 
   94 ENDDOCUMENT();       # This should be the last executable line in the problem.
   95 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9