| … | |
… | |
| 13 | |
13 | |
| 14 | TEXT(beginproblem()); |
14 | TEXT(beginproblem()); |
| 15 | |
15 | |
| 16 | ########################################################## |
16 | ########################################################## |
| 17 | # |
17 | # |
| 18 | # Use Vector context |
18 | # The setup |
| 19 | # |
19 | # |
| 20 | |
20 | |
| 21 | Context('Vector'); |
21 | Context('Interval'); |
| 22 | |
22 | |
| 23 | $P1 = Point(1,random(-3,3,1),random(-3,3,1)); |
23 | $p1 = random(-5,2,1); |
| 24 | $P2 = Point(random(-3,3,1),4,random(-3,3,1)); |
24 | $p2 = random($p1+1,$p1+7,1); |
| 25 | |
25 | |
| 26 | $V = Vector($P2-$P1); |
26 | $f = Formula("x^2 - ($p1+$p2) x + $p1*$p2")->reduce; |
| 27 | |
27 | $I = Interval("($p1,$p2)"); |
| 28 | Context()->flags->set(ijk=>0); |
|
|
| 29 | Context()->constants->add(a=>1,b=>1,c=>1); |
|
|
| 30 | |
|
|
| 31 | $ABC = Formula("<a,b,c>"); |
|
|
| 32 | |
28 | |
| 33 | ########################################################## |
29 | ########################################################## |
| 34 | # |
30 | # |
| 35 | # The problem text |
31 | # The problem text |
| 36 | # |
32 | # |
| 37 | |
33 | |
|
|
34 | Context()->texStrings; |
| 38 | BEGIN_TEXT |
35 | BEGIN_TEXT |
| 39 | The vector from \(\{$P1->TeX\}\) to \(\{$P2->TeX\}\) is \{ans_rule(20)\}. |
36 | The function \(f(x) = $f\) is negative for values of \(x\) in the interval |
| 40 | $PAR |
37 | \{ans_rule(20)\}. |
| 41 | You can use either \(\{$ABC->TeX\}\) or \(\{$ABC->ijk\}\) notation,$BR |
|
|
| 42 | and can perform vector operations to produce your answer. |
|
|
| 43 | END_TEXT |
38 | END_TEXT |
|
|
39 | Context()->normalStrings; |
| 44 | |
40 | |
| 45 | ########################################################### |
41 | ########################################################### |
| 46 | # |
42 | # |
| 47 | # The answer |
43 | # The answer |
| 48 | # |
44 | # |
| 49 | |
45 | |
| 50 | ANS($V->cmp(promotePoints=>1)); |
46 | ANS($I->cmp); |
| 51 | |
47 | |
| 52 | ########################################################### |
48 | ########################################################### |
| 53 | |
49 | |
| 54 | ENDDOCUMENT(); # This should be the last executable line in the problem. |
50 | ENDDOCUMENT(); # This should be the last executable line in the problem. |