[npl] / branches / UWSP / SS4e_01_01_015.pg Repository:
ViewVC logotype

View of /branches/UWSP/SS4e_01_01_015.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2521 - (download) (annotate)
Mon Oct 31 22:39:21 2011 UTC (19 months, 2 weeks ago) by nwodarz
File size: 4460 byte(s)
Submitting Precalculus Section 1.1

    1 ##DESCRIPTION
    2 ##   Identifying coordinates of points
    3 ##ENDDESCRIPTION
    4 
    5 ##KEYWORDS('quadrant', 'rectangular coordinates')
    6 
    7 ## DBsubject('Algebra')
    8 ## DBchapter('Coordinates and Graphs')
    9 ## DBsection('The Coordinate Plane')
   10 ## Author('Nathan Wodarz')
   11 ## Institution('UWSP')
   12 ## TitleText1('Precalculus Enhanced with Graphing Utilities')
   13 ## EditionText1('4')
   14 ## AuthorText1('Sullivan, Sullivan')
   15 ## Section1('1.1')
   16 ## Problem1('15')
   17 #
   18 # First comes some stuff that appears at the beginning of every problem
   19 #
   20 
   21 DOCUMENT();        # This should be the first executable line in the problem.
   22 
   23 loadMacros(
   24 # Always call these
   25 "PGstandard.pl",
   26 "MathObjects.pl",
   27 "PGcourse.pl",
   28 "PGunion.pl",
   29 # Extra calls for this problem
   30 "PGgraphmacros.pl",
   31 "PGchoicemacros.pl",
   32 "parserRadioButtons.pl",
   33 );
   34 
   35 
   36 TEXT(&beginproblem);
   37 BEGIN_PROBLEM();
   38 $refreshCachedImages = 1;
   39 
   40 Context("Numeric");
   41 
   42 # Choose points to show
   43 
   44 ($x1, $x2, $x3) = NchooseK(10,3);
   45 ($y1, $y2, $y3) = NchooseK(10,3);
   46 
   47 $x1 = $x1 - 5 + int(($x1)/5);
   48 $x2 = $x2 - 5 + int(($x2)/5);
   49 $x3 = $x3 - 5 + int(($x3)/5);
   50 
   51 $y1 = $y1 - 5 + int(($y1)/5);
   52 $y2 = $y2 - 5 + int(($y2)/5);
   53 $y3 = $y3 - 5 + int(($y3)/5);
   54 
   55 if (($x1 > 0) && ($y1 > 0)) {
   56   $Quad1 = "Quadrant I";
   57 } elsif (($x1 < 0) && ($y1 > 0)) {
   58   $Quad1 = "Quadrant II";
   59 } elsif (($x1 < 0) && ($y1 < 0)) {
   60   $Quad1 = "Quadrant III";
   61 } elsif (($x1 > 0) && ($y1 < 0)) {
   62   $Quad1 = "Quadrant IV";
   63 }
   64 
   65 if (($x2 > 0) && ($y2 > 0)) {
   66   $Quad2 = "Quadrant I";
   67 } elsif (($x2 < 0) && ($y2 > 0)) {
   68   $Quad2 = "Quadrant II";
   69 } elsif (($x2 < 0) && ($y2 < 0)) {
   70   $Quad2 = "Quadrant III";
   71 } elsif (($x2 > 0) && ($y2 < 0)) {
   72   $Quad2 = "Quadrant IV";
   73 }
   74 
   75 if (($x3 > 0) && ($y3 > 0)) {
   76   $Quad3 = "Quadrant I";
   77 } elsif (($x3 < 0) && ($y3 > 0)) {
   78   $Quad3 = "Quadrant II";
   79 } elsif (($x3 < 0) && ($y3 < 0)) {
   80   $Quad3 = "Quadrant III";
   81 } elsif (($x3 > 0) && ($y3 < 0)) {
   82   $Quad3 = "Quadrant IV";
   83 }
   84 
   85 $P1quad = RadioButtons(
   86   ["Quadrant I", "Quadrant II", "Quadrant III", "Quadrant IV", "None of these"],
   87   $Quad1, # correct answer
   88   last => ["Quadrant I", "Quadrant II", "Quadrant III", "Quadrant IV", "None of these"], # can be a list
   89 );
   90 
   91 $P2quad = RadioButtons(
   92   ["Quadrant I", "Quadrant II", "Quadrant III", "Quadrant IV", "None of these"],
   93   $Quad2, # correct answer
   94   last => ["Quadrant I", "Quadrant II", "Quadrant III", "Quadrant IV", "None of these"], # can be a list
   95 );
   96 
   97 $P3quad = RadioButtons(
   98   ["Quadrant I", "Quadrant II", "Quadrant III", "Quadrant IV", "None of these"],
   99   $Quad3, # correct answer
  100   last => ["Quadrant I", "Quadrant II", "Quadrant III", "Quadrant IV", "None of these"], # can be a list
  101 );
  102 
  103 # Graph the points
  104 
  105 $dom = 6;
  106 $grids =12;
  107 $graph = init_graph(-$dom,-$dom,$dom,$dom,grid =>[$grids,$grids], axes => [0,0]);
  108 $graph ->stamps( closed_circle($x1, $y1, 'blue') );
  109 $graph ->stamps( closed_circle($x2, $y2, 'red') );
  110 $graph ->stamps( closed_circle($x3, $y3, 'black') );
  111 
  112 $label_f1 = new Label ($x1+.2,$y1,'P','blue','left');
  113 $label_f2 = new Label ($x2+.2,$y2,'Q','red','left');
  114 $label_f3 = new Label ($x3+.2,$y3,'R','black','left');
  115 
  116 $graph->lb($label_f1,$label_f2,$label_f3);
  117 
  118 $graph->gifName($graph->gifName()."-$newProblemSeed");
  119 
  120 Context()->texStrings;
  121 BEGIN_TEXT
  122 Determine the coordinates of the points shown. Assume the coordinates are integers. Give your answers as ordered pairs. The point \(P\) is depicted in blue, the point \(Q\) is in red and the point \(R\) is in black.$PAR
  123 \{ image(insertGraph($graph),height=>400,width=>400) \}
  124 $PAR
  125 The coordinates of point \(P\) are \((x,y) = \) \{ans_rule(6)\}$PAR
  126 What quadrant is the point \(P\) in?$BR
  127 \{ $P1quad->buttons() \}
  128 $PAR
  129 The coordinates of point \(Q\) are \((x,y) = \) \{ans_rule(6)\}$PAR
  130 What quadrant is the point \(Q\) in?$BR
  131 \{ $P2quad->buttons() \}
  132 $PAR
  133 The coordinates of point \(R\) are \((x,y) = \) \{ans_rule(6)\}$PAR
  134 What quadrant is the point \(R\) in?$BR
  135 \{ $P3quad->buttons() \}
  136 END_TEXT
  137 Context()->normalStrings;
  138 
  139 ## Do NOT show partial correct answers
  140 $showPartialCorrectAnswers = 0;
  141 install_problem_grader(~~&std_problem_grader);
  142 
  143 Context("Point");
  144 ANS(Compute("($x1,$y1)")->cmp);
  145 ANS( $P1quad->cmp() );
  146 
  147 ANS(Compute("($x2,$y2)")->cmp);
  148 ANS( $P2quad->cmp() );
  149 
  150 ANS(Compute("($x3,$y3)")->cmp);
  151 ANS( $P3quad->cmp() );
  152 
  153 END_PROBLEM();
  154 ENDDOCUMENT();        # This should be the last executable line in the problem.
  155 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9