[npl] / trunk / NationalProblemLibrary / WHFreeman / Rogawski_Calculus_Early_Transcendentals_Second_Edition / 12_Vector_Geometry / 12.3_Dot_Product_and_the_Angle_Between_Two_Vectors / 12.3.46.pg Repository:
ViewVC logotype

View of /trunk/NationalProblemLibrary/WHFreeman/Rogawski_Calculus_Early_Transcendentals_Second_Edition/12_Vector_Geometry/12.3_Dot_Product_and_the_Angle_Between_Two_Vectors/12.3.46.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2584 - (download) (annotate)
Tue Nov 8 15:17:41 2011 UTC (18 months, 1 week ago) by aubreyja
File size: 4336 byte(s)
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('46')
   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 
   20 sub vdot
   21 {
   22     my($temp) = 0;
   23 
   24     for ($i = 0; $i < 3; $i++)
   25     {
   26         $temp = $temp + $_[$i] * $_[$i + 3];
   27     }
   28     return $temp
   29 }
   30 
   31 sub vlen
   32 {
   33     return sqrt($_[0]**2 + $_[1]**2 + $_[2]**2);
   34 }
   35 
   36 sub vcos
   37 {
   38     my($dot) = vdot(@_);
   39 
   40     return $dot / (vlen($_[0], $_[1], $_[2]) * vlen($_[3], $_[4], $_[5]));
   41 }
   42 
   43 sub vang
   44 {
   45     return Formula("arccos(x)")->eval(x=>vcos(@_));
   46 }
   47 
   48 # projection of u onto v (first onto second)
   49 sub vproj
   50 {
   51     my(@temp) = ($_[3], $_[4], $_[5]);
   52     my($temp2) = vdot(@_);
   53 
   54     $temp2 = $temp2 / vdot($_[3], $_[4], $_[5], $_[3], $_[4], $_[5]);
   55 
   56     $temp[0] *= $temp2;
   57     $temp[1] *= $temp2;
   58     $temp[2] *= $temp2;
   59 
   60     return @temp;
   61 }
   62 
   63 # perpendicular component of u onto v (first onto second)
   64 sub vperp
   65 {
   66     my(@temp) = vproj(@_);
   67 
   68     $temp[0] = -1 * $temp[0] + $_[0];
   69     $temp[1] = -1 * $temp[1] + $_[1];
   70     $temp[2] = -1 * $temp[2] + $_[2];
   71 
   72     return @temp;
   73 }
   74 
   75 $rad = Real(random(0.1, pi, 0.1));
   76 $lenv = Real(random(1, 5, 1));
   77 $lenw = Real(random(1, 5, 1));
   78 
   79 $a1 = Real(random(1, 4, 1));
   80 $b1 = Real(random(1, 4, 1));
   81 
   82 $a2 = Real(random(1, 4, 1));
   83 $b2 = Real(random(-4, -1, 1));
   84 
   85 
   86 $ans1 = Formula("$lenv * $lenw * cos($rad)")->eval();
   87 $ans2 = sqrt($a1**2 * $lenv**2 + 2 * $a1 * $b1 * $ans1 + $b1**2 * $lenw**2);
   88 $ans3 = sqrt($a2**2 * $lenv**2 + 2 * $a2 * $b2 * $ans1 + $b2**2 * $lenw**2);
   89 
   90 Context()->texStrings;
   91 BEGIN_TEXT
   92 \{ beginproblem() \}
   93 \{ textbook_ref_exact("Rogawski ET 2e", "12.3","46") \}
   94 $PAR
   95 \( \| v \| = $lenv \)
   96 $PAR
   97 \( \| w \| = $lenw \)
   98 $PAR
   99 The angle between \( v \) and \( w \) is $rad radians.
  100 $PAR
  101 Given this information, calculate the following:
  102 $PAR
  103 (a) \( v \cdotp w \) = \{ans_rule()\}
  104 $PAR
  105 (b) \( \| $a1 v + $b1 w \| = \) \{ans_rule()\}
  106 $PAR
  107 (c) \( \| $a2 v + $b2 w \| = \) \{ans_rule()\}
  108 $PAR
  109 END_TEXT
  110 Context()->normalStrings;
  111 
  112 ANS($ans1->cmp, $ans2->cmp, $ans3->cmp);
  113 
  114 Context()->texStrings;
  115 SOLUTION(EV3(<<'END_SOLUTION'));
  116 $PAR
  117 $SOL
  118 $PAR
  119 (a) We know that \( v \cdotp w = \| v \| \| w \| \cos{\theta} \), so
  120 $PAR
  121 \( v \cdotp w = $lenv ($lenw) \cos{($rad)} = $ans1 \).
  122 $PAR
  123 (b) Since \( u \cdotp u = {\| u \|}^{2} \),
  124 $PAR
  125 we know that \( \| $a1 v + $b1 w \| = \sqrt{($a1 v + $b1 w) \cdotp ($a1 v +  $b1 w)} \).
  126 $PAR
  127 Multiplying this out (using the distributive property of dot products) we get:
  128 $PAR
  129  \( \| $a1 v + $b1 w \| = \sqrt{ \{$a1**2\}(v \cdotp v) + \{2 * $a1 * $b1\}(v \cdotp w) + \{$b1**2\}(w \cdotp w)} \).
  130 $PAR
  131 We can simplify this further because we know \( \| w \| = $lenw \) and \( \| v \| = $lenv \) and \( v \cdotp w = $ans1 \) (from part a):
  132 $PAR
  133 \( \| $a1 v + $b1 w \| = \sqrt{ \{$a1**2\}({$lenv}^2) + \{2 * $a1 * $b1\}($ans1) + \{$b1**2\}({$lenw}^2)} \).
  134 $PAR
  135 And finally,
  136 $PAR
  137 \( \| $a1 v + $b1 w \| = \sqrt{ \{$a1**2 * $lenv**2 + 2 * $a1 * $b1 * $ans1 + $b1**2 * $lenw**2\} } = $ans2 \).
  138 $PAR
  139 (c) Since \( u \cdotp u = {\| u \|}^{2} \),
  140 $PAR
  141 we know that \( \| $a2 v + $b2 w \| = \sqrt{($a2 v + $b2 w) \cdotp ($a2 v +  $b2 w)} \).
  142 $PAR
  143 Multiplying this out (using the distributive property of dot products) we get:
  144 $PAR
  145  \( \| $a2 v + $b2 w \| = \sqrt{ \{$a2**2\}(v \cdotp v) + \{2 * $a2 * $b2\}(v \cdotp w) + \{$b2**2\}(w \cdotp w)} \).
  146 $PAR
  147 We can simplify this further because we know \( \| w \| = $lenw \) and \( \| v \| = $lenv \) and \( v \cdotp w = $ans1 \) (from part a):
  148 $PAR
  149 \( \| $a2 v + $b2 w \| = \sqrt{ \{$a2**2\}({$lenv}^2) + \{2 * $a2 * $b2\}($ans1) + \{$b2**2\}({$lenw}^2)} \).
  150 $PAR
  151 And finally,
  152 $PAR
  153 \( \| $a2 v + $b2 w \| = \sqrt{ \{$a2**2 * $lenv**2 + 2 * $a2 * $b2 * $ans1 + $b2**2 * $lenw**2\} } = $ans3 \).
  154 END_SOLUTION
  155 
  156 ENDDOCUMENT();
  157 
  158 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9