Parent Directory
|
Revision Log
Rogawski problems contributed by publisher WHFreeman. These are a subset of the problems available to instructors who use the Rogawski textbook. The remainder can be obtained from the publisher.
1 ## DBsubject('Calculus') 2 ## DBchapter('Vector Geometry') 3 ## DBsection('Dot Product and the Angle Between Two Vectors') 4 ## KEYWORDS('calculus', 'parametric', 'vector', 'dot product', 'scalar product', 'angle', 'projection', 'proj') 5 ## TitleText1('Calculus: Early Transcendentals') 6 ## EditionText1('2') 7 ## AuthorText1('Rogawski') 8 ## Section1('12.3') 9 ## Problem1('11') 10 ## Author('Christopher Sira') 11 ## Institution('W.H.Freeman') 12 13 DOCUMENT(); 14 loadMacros("PG.pl","PGbasicmacros.pl","PGanswermacros.pl"); 15 loadMacros("PGchoicemacros.pl"); 16 loadMacros("Parser.pl"); 17 loadMacros("freemanMacros.pl"); 18 $context = Context("Vector"); 19 Context()->flags->set(ijk=>1); 20 21 sub vdot 22 { 23 my($temp) = 0; 24 25 for ($i = 0; $i < 3; $i++) 26 { 27 $temp = $temp + $_[$i] * $_[$i + 3]; 28 } 29 return $temp 30 } 31 32 sub vlen 33 { 34 return sqrt($_[0]**2 + $_[1]**2 + $_[2]**2); 35 } 36 37 sub vcos 38 { 39 my($dot) = vdot(@_); 40 41 return $dot / (vlen($_[0], $_[1], $_[2]) * vlen($_[3], $_[4], $_[5])); 42 } 43 44 sub vang 45 { 46 return Formula("arccos(x)")->eval(x=>vcos(@_)); 47 } 48 49 # projection of u onto v (first onto second) 50 sub vproj 51 { 52 my(@temp) = ($_[3], $_[4], $_[5]); 53 my($temp2) = vdot(@_); 54 55 $temp2 = $temp2 / vdot($_[3], $_[4], $_[5], $_[3], $_[4], $_[5]); 56 57 $temp[0] *= $temp2; 58 $temp[1] *= $temp2; 59 $temp[2] *= $temp2; 60 61 return @temp; 62 } 63 64 # perpendicular component of u onto v (first onto second) 65 sub vperp 66 { 67 my(@temp) = vproj(@_); 68 69 $temp[0] = -1 * $temp[0] + $_[0]; 70 $temp[1] = -1 * $temp[1] + $_[1]; 71 $temp[2] = -1 * $temp[2] + $_[2]; 72 73 return @temp; 74 } 75 76 $iv0 = 1; 77 $iv1 = 0; 78 $iv2 = 0; 79 80 $jv0 = 0; 81 $jv1 = 1; 82 $jv2 = 0; 83 84 $kv0 = 0; 85 $kv1 = 0; 86 $kv2 = 1; 87 88 @iva = ($iv0, $iv1, $iv2); 89 @jva = ($jv0, $jv1, $jv2); 90 @kva = ($kv0, $kv1, $kv2); 91 92 $iv = Vector(@iva); 93 $jv = Vector(@jva); 94 $kv = Vector(@kva); 95 96 $v0 = Real(random(-10, 10, 1)); 97 $v1 = Real(random(-10, 10, 1)); 98 $v2 = Real(random(-10, 10, 1)); 99 100 # make unit vector 101 #$v0 = $v0 / vlen($v0, $v1, $v2); 102 #$v1 = $v1 / vlen($v0, $v1, $v2); 103 #$v2 = $v2 / vlen($v0, $v1, $v2); 104 105 106 $w0 = Real(random(-10, 10, 1)); 107 $w1 = Real(random(-10, 10, 1)); 108 $w2 = Real(random(-10, 10, 1)); 109 110 # make unit vector 111 #$w0 = $v0 / vlen($v0, $v1, $v2); 112 #$w1 = $v1 / vlen($v0, $v1, $v2); 113 #$w2 = $v2 / vlen($v0, $v1, $v2); 114 115 @va = ($v0, $v1, $v2); 116 @wa = ($w0, $w1, $w2); 117 118 $v = Vector($v0, $v1, $v2); 119 $w = Vector($w0, $w1, $w2); 120 121 $ans = vdot(@va, @wa); 122 123 Context()->texStrings; 124 BEGIN_TEXT 125 \{ beginproblem() \} 126 \{ textbook_ref_exact("Rogawski ET 2e", "12.3","11") \} 127 $PAR 128 \( v = $v \) 129 $PAR 130 \( w = $w \) 131 $PAR 132 Compute the dot product \( v \cdotp w \). 133 $PAR 134 \{ans_rule()\} 135 END_TEXT 136 Context()->normalStrings; 137 138 ANS($ans->cmp); 139 140 Context()->texStrings; 141 SOLUTION(EV3(<<'END_SOLUTION')); 142 $PAR 143 $SOL 144 \( v \cdotp w = ($v) \cdotp ($w) \) $BR 145 \(\quad = ($v0 \cdot $w0) + ($v1 \cdot $w1) + ($v2 \cdot $w2) = $ans \) 146 END_SOLUTION 147 148 ENDDOCUMENT(); 149 150
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |