Parent Directory
|
Revision Log
Revision 134 - (view) (download)
| 1 : | jj | 134 | ## -*- perl -*- ## |
| 2 : | ## Line above puts emacs in perl mode | ||
| 3 : | ## | ||
| 4 : | ## Description | ||
| 5 : | ## Plane through point orthogonal to given line | ||
| 6 : | ## EndDescription | ||
| 7 : | |||
| 8 : | DOCUMENT(); | ||
| 9 : | loadMacros("PG.pl", | ||
| 10 : | "PGbasicmacros.pl", | ||
| 11 : | "PGchoicemacros.pl", | ||
| 12 : | "PGanswermacros.pl", | ||
| 13 : | "PGauxiliaryFunctions.pl", | ||
| 14 : | "PGgraphmacros.pl", | ||
| 15 : | "Dartmouthmacros.pl"); | ||
| 16 : | |||
| 17 : | |||
| 18 : | ## Do NOT show partial correct answers | ||
| 19 : | $showPartialCorrectAnswers = 0; | ||
| 20 : | |||
| 21 : | ## Grab a point @p and a normal vector @n | ||
| 22 : | @p = (); | ||
| 23 : | @n = (); | ||
| 24 : | for ($i=0; $i < 3; $i++) | ||
| 25 : | { | ||
| 26 : | $p[$i] = random(-10,10,1); | ||
| 27 : | $n[$i] = non_zero_random(-10,10,1); | ||
| 28 : | } | ||
| 29 : | |||
| 30 : | |||
| 31 : | ## Ok, we are ready to begin the problem... | ||
| 32 : | ## | ||
| 33 : | |||
| 34 : | ## The point through which the line passes when t = 0 is irrelevant | ||
| 35 : | ## I just didn't want to generate more constants | ||
| 36 : | TEXT(beginproblem()); | ||
| 37 : | |||
| 38 : | |||
| 39 : | BEGIN_TEXT | ||
| 40 : | $BR | ||
| 41 : | Find an equation of the plane orthogonal to the line | ||
| 42 : | \[ (x,y,z) = ($p[2],$p[0], $p[1]) + t\, ($n[0], $n[1], $n[2]) \] | ||
| 43 : | $BR | ||
| 44 : | |||
| 45 : | which passes through the point ($p[0], $p[1], $p[2]). | ||
| 46 : | $PAR | ||
| 47 : | Give your answer in the form \( a x + b y + c z = d \) | ||
| 48 : | (with \( a = \{abs($n[0])\} \)). | ||
| 49 : | $BR | ||
| 50 : | a = \{ans_rule()\}$BR | ||
| 51 : | b = \{ans_rule()\}$BR | ||
| 52 : | c = \{ans_rule()\}$BR | ||
| 53 : | d = \{ans_rule()\}$BR | ||
| 54 : | END_TEXT | ||
| 55 : | |||
| 56 : | if ($n[0] > 0) | ||
| 57 : | { | ||
| 58 : | ANS(std_num_cmp($n[0])); | ||
| 59 : | ANS(std_num_cmp($n[1])); | ||
| 60 : | ANS(std_num_cmp($n[2])); | ||
| 61 : | ANS(std_num_cmp($n[0]*$p[0] + $n[1]*$p[1] + $n[2]*$p[2])); | ||
| 62 : | } | ||
| 63 : | else | ||
| 64 : | { | ||
| 65 : | ANS(std_num_cmp(- $n[0])); | ||
| 66 : | ANS(std_num_cmp(- $n[1])); | ||
| 67 : | ANS(std_num_cmp(- $n[2])); | ||
| 68 : | ANS(std_num_cmp(- $n[0]*$p[0] - $n[1]*$p[1] - $n[2]*$p[2])); | ||
| 69 : | } | ||
| 70 : | ENDDOCUMENT(); | ||
| 71 : | |||
| 72 : | |||
| 73 : | |||
| 74 : |
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |