[npl] / branches / UGA / 5.3.3.pg Repository:
ViewVC logotype

View of /branches/UGA/5.3.3.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1457 - (download) (annotate)
Sat Jul 24 17:09:50 2010 UTC (2 years, 9 months ago) by ted shifrin
File size: 3195 byte(s)
Log message

    1 ## DESCRIPTION
    2 ##   Classify Critical Points
    3 ## ENDDESCRIPTION
    4 
    5 ## KEYWORDS('Critical', 'Point', 'Saddle', 'Maximum', 'Minimum')
    6 ## Tagged by nhamblet
    7 
    8 ## DBsubject('Calculus')
    9 ## DBchapter('Partial Derivatives')
   10 ## DBsection('Maximum and Minimum Values')
   11 ## Date('8/23/07')
   12 ## Author('modified by Shifrin')
   13 ## Institution('Union College')
   14 ## TitleText1('')
   15 ## EditionText1('')
   16 ## AuthorText1('')
   17 ## Section1('')
   18 ## Problem1('')
   19 ## TitleText2('Calculus: Early Transcendentals')
   20 ## EditionText2('1')
   21 ## AuthorText2('Rogawski')
   22 ## Section2('14.7')
   23 ## Problem2('5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20')
   24 
   25 DOCUMENT();        # This should be the first executable line in the problem.
   26 
   27 loadMacros(
   28   "PGstandard.pl",
   29   "PGunion.pl",
   30   "MathObjects.pl",
   31   "contextString.pl",
   32   "parserVectorUtils.pl",
   33   "PGchoicemacros.pl",
   34   "PGcourse.pl",
   35 );
   36 
   37 
   38 TEXT(beginproblem);
   39 
   40 ##############################################
   41 #  Setup
   42 
   43 Context("Vector")->flags->set(
   44   reduceConstants => 0,
   45   reduceConstantFunctions => 0,
   46 );
   47 
   48 #
   49 #  The function
   50 #
   51 $c = random(2,5,1);
   52 $a = 3*$c**2;
   53 
   54 $f = Formula("x^2 y + y^3 - $a y");
   55 $arg = '\left(\begin{array}{c} x\\y \end{array}\right)';
   56 
   57 $P1 = ColumnVector(0,0);
   58 $P2 = ColumnVector(0,$c);
   59 $P3 = ColumnVector(0,-$c);
   60 $P4 = ColumnVector(Formula("$c*sqrt(3)"),0);
   61 $P5 = ColumnVector(Formula("-$c*sqrt(3)"),0);
   62 
   63 ##############################################
   64 
   65 $context{'String'}->strings->add(
   66   "a maximum" => {},
   67   "a minimum" => {},
   68   "a saddle" => {},
   69   "some other critical point" => {},
   70   "no critical point" => {},
   71   "no_answer" => {string => "", TeX => ""},
   72 );
   73 
   74 #
   75 #  The various pop-up choices
   76 #
   77 @pop_up_choices = (
   78   no_answer => "?",
   79   "a maximum" => "a maximum",
   80   "a minimum" => "a minimum",
   81   "a saddle"  => "a saddle",
   82   "some other critical point" => "some other critical point",
   83   "no critical point" => "no critical point",
   84 );
   85 
   86 %shorthand = (
   87   "max"    => "a maximum",
   88   "min"    => "a minimum",
   89   "saddle" => "a saddle",
   90   "other"  => "some other critical point",
   91   "none"   => "no critical point",
   92 );
   93 
   94 @ans = ();
   95 
   96 #
   97 #  Make a pop up question and answer
   98 #
   99 sub PopUp {
  100   my @ropts = (separation => 0);
  101   my $p = shift; my $type = shift;
  102   push(@ans,$shorthand{$type});
  103   Row(["\(f\) has ".pop_up_list(@pop_up_choices).
  104        " at \(".$p->TeX."\).".$PAR],@ropts);
  105 }
  106 
  107 #
  108 #  Print the list of questions as a table
  109 #
  110 sub PrintQ {
  111   my @questions = @_;
  112   my @rows = ();
  113   foreach my $q (@questions) {push(@rows,PopUp(@{$q}))}
  114   return join(TableSpace(5,0),@rows);
  115 }
  116 
  117 ##############################################
  118 #  Main text and answers
  119 
  120 Context()->texStrings;
  121 BEGIN_TEXT
  122 
  123 Consider the function \(f $arg = $f\).
  124 
  125 $BCENTER
  126 $PAR
  127 \{
  128   BeginTable(center=>0).
  129     PrintQ((
  130       [$P1,"none"],
  131       [$P2,"min"],
  132       [$P3,"max"],
  133       [$P4,"saddle"],
  134       [$P5,"saddle"],
  135     )[shuffle(5)]).
  136   EndTable()
  137 \}
  138 $ECENTER
  139 
  140 END_TEXT
  141 Context()->normalStrings;
  142 
  143 ##################################################
  144 
  145 Context("String");
  146 
  147 ANS(string_cmp(@ans));
  148 
  149 install_problem_grader(~~&std_problem_grader);
  150 $showPartialCorrectAnswers = 0;
  151 
  152 ##################################################
  153 
  154 ENDDOCUMENT();        # This should be the last executable line in the problem.

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9