Parent Directory
|
Revision Log
see bug 1779
1 ## DESCRIPTION 2 ## Linear Algebra 3 ## ENDDESCRIPTION 4 5 ## KEYWORDS('inner product' 'orthogonal' 'angle') 6 ## Tagged by tda2d 7 8 ## DBsubject('Linear Algebra') 9 ## DBchapter('Vector Spaces') 10 ## DBsection('Inner Product') 11 ## Date('') 12 ## Author('') 13 ## Institution('TCNJ') 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 "PGanswermacros.pl", 26 "PGauxiliaryFunctions.pl", 27 "PGmatrixmacros.pl" 28 ); 29 30 TEXT(beginproblem()); 31 $showPartialCorrectAnswers = 1; 32 33 @x=(0,0); 34 @y=(0,0); 35 36 while($x[0]*$y[1]==$x[1]*$y[0]) 37 { 38 $prod = 0; 39 $norm_x = 0; 40 $norm_y = 0; 41 foreach $i (0..1) { 42 $x[$i] = non_zero_random(-5,5,1); 43 $y[$i] = non_zero_random(-5,5,1); 44 if ($y[$i] == $x[$i]) { 45 $y[$i] = 6; 46 } 47 $prod += $x[$i] * $y[$i]; 48 $norm_x += $x[$i] * $x[$i]; 49 $norm_y += $y[$i] * $y[$i]; 50 } 51 } 52 53 $norm_x = sqrt($norm_x); 54 $norm_y = sqrt($norm_y); 55 56 $angle = arccos( $prod / $norm_x / $norm_y); 57 58 BEGIN_TEXT 59 Find the angle \( \alpha \) between the vectors 60 \{ mbox( display_matrix([[$x[0]], [$x[1]]]), ' and ', display_matrix([[$y[0]], [$y[1]]]), '.' ) \} 61 $BR 62 \( \alpha = \) \{ans_rule(20)\}. 63 64 END_TEXT 65 66 ANS(num_cmp($angle)); 67 68 69 ENDDOCUMENT(); # This should be the last executable line in the problem. 70
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |