[npl] / trunk / NationalProblemLibrary / Rochester / setVectors2DotProduct / UR_VC_1_13.pg Repository:
ViewVC logotype

Annotation of /trunk/NationalProblemLibrary/Rochester/setVectors2DotProduct/UR_VC_1_13.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 140 - (view) (download)

1 : jj 140 ##DESCRIPTION
2 :     # First Created: 5/31/00
3 :     # Last Modified: 6/1/00
4 :     # Author: Joseph Neisendorfer
5 :     # WebworK Entry: Robert Van Dam
6 :     # Location: University of Rochester
7 :     #
8 :     # Math 164 Problems - Assignment 1 - Problem 13
9 :     ##ENDDESCRIPTION
10 :    
11 :     ##KEYWORDS("vector')
12 :    
13 :     DOCUMENT();
14 :    
15 :     loadMacros(
16 :     "PG.pl",
17 :     "PGbasicmacros.pl",
18 :     "PGchoicemacros.pl",
19 :     "PGanswermacros.pl",
20 :     "PGauxiliaryFunctions.pl"
21 :     );
22 :    
23 :     TEXT(beginproblem());
24 :     $showPartialCorrectAnswers = 1;
25 :    
26 :     $a = non_zero_random(-10, 10);
27 :     $b = random(-10, 10);
28 :     $c = random(-10, 10);
29 :     $d = non_zero_random(-10, 10);
30 :     $e = random(-10, 10);
31 :     $f = random(-10, 10);
32 :    
33 :     $adbecf = $a*$d + $b*$e + $c*$f;
34 :    
35 :     $dist1 = sqrt(($a)**2 + ($b)**2 + ($c)**2);
36 :     $dist2 = sqrt(($d)**2 + ($e)**2 + ($f)**2);
37 :    
38 :     $ans = arccos($adbecf/($dist1*$dist2));
39 :    
40 :     BEGIN_TEXT
41 :     $PAR
42 :     What is the angle in radians between the vectors
43 :     $BR \( {\bf a} \) = ($a, $b, $c)
44 :     and $BR \( {\bf b} \) = ($d, $e, $f)?
45 :    
46 :     $PAR Angle: \{ ans_rule(60) \} (radians)
47 :     END_TEXT
48 :     ANS(num_cmp($ans));
49 :    
50 :     ENDDOCUMENT();

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9