[npl] / trunk / NationalProblemLibrary / Michigan / Chap5Sec1 / Q25.pg Repository:
ViewVC logotype

View of /trunk/NationalProblemLibrary/Michigan/Chap5Sec1/Q25.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1003 - (download) (annotate)
Tue Mar 3 03:20:27 2009 UTC (4 years, 2 months ago) by glarose
File size: 4740 byte(s)
UMich NPL: try to bring all files up to date with current HH 4th and
5th edition tagging

    1 # DESCRIPTION
    2 # Problem from Calculus, single variable, Hughes-Hallett et al., 4th ed.
    3 # WeBWorK problem written by Gavin LaRose, <glarose@umich.edu>
    4 # ENDDESCRIPTION
    5 
    6 ## KEYWORDS('calculus', 'integral', 'definite integrals', 'distance')
    7 ## Tagged by glr 02/08/09
    8 
    9 ## DBsubject('Calculus')
   10 ## DBchapter('Integrals')
   11 ## DBsection('Area and Distance')
   12 ## Date('')
   13 ## Author('Gavin LaRose')
   14 ## Institution('University of Michigan')
   15 ## TitleText1('Calculus')
   16 ## EditionText1('4')
   17 ## EditionText2('5')
   18 ## AuthorText1('Hughes-Hallett')
   19 ## AuthorText2('Hughes-Hallett')
   20 ## Section1('5.1')
   21 ## Section2('5.1')
   22 ## Problem1('25')
   23 ## Problem2('26')
   24 
   25 ## Textbook tags
   26 ## HHChapter1('Key Concept: The Definite Integral')
   27 ## HHChapter2('Key Concept: The Definite Integral')
   28 ## HHSection1('How Do We Measure Distance Traveled')
   29 ## HHSection2('How Do We Measure Distance Traveled')
   30 
   31 
   32 DOCUMENT();
   33 loadMacros(
   34 "PGstandard.pl",
   35 "MathObjects.pl",
   36 "PGgraphmacros.pl",
   37 "PGchoicemacros.pl",
   38 # "PGcourse.pl",
   39 );
   40 
   41 # make sure we're in the context we want
   42 Context("Numeric");
   43 
   44 $gr = init_graph(-0.1,-0.1,1.1,2,axes=>[0,0],size=>[150,150]);
   45 $gr->lb('reset');
   46 
   47 $abSpike   = list_random("A","B");    # is car A or B the spike?
   48 $spikeLoc  = list_random(0.15,0.75);  # location of spike
   49 $whichFlat = list_random(0,1);        # which flat velocity to use
   50 
   51 @flat = ( );
   52 if ( $whichFlat ) {
   53     $flat[0] = "4*x*(1-x) for x in <0,1> using color:blue and weight:2";
   54 } else {
   55     $flat[0] = "4*x for x in <0,0.25> using color:blue and weight:2";
   56     $flat[1] = "1 for x in <0.25,0.75> using color:blue and weight:2";
   57     $flat[2] = "1 - 4*(x-0.75)  for x in <0.75,1> using color:blue " .
   58          "and weight:2";
   59 }
   60 
   61 sub spikeF {
   62     my $x = shift();
   63     return 1.5*exp(-1*($x-$spikeLoc)**2/(0.0018));
   64 }
   65 
   66 $spikeFunc = "1.5*e^(-(x-$spikeLoc)^2/(0.0018))";
   67 for ( my $i=0; $i<=$spikeLoc-0.144; $i+=0.006 ) {
   68     $j = $i + 0.0025;
   69     push( @spike, "0 for x in <$i,$j> using color:red and " .
   70     "weight:2" );
   71 }
   72 for ( my $i=$spikeLoc-0.15; $i<=$spikeLoc+0.144; $i+=0.006 ) {
   73     $j = $i + 0.0025;
   74     push( @spike, "$spikeFunc for x in <$i,$j> using color:red and " .
   75     "weight:2" );
   76 }
   77 
   78 add_functions( $gr, @flat );
   79 add_functions( $gr, @spike );
   80 
   81 $maxVel    = new_multiple_choice();
   82 $firstStop = new_multiple_choice();
   83 $distTrav  = new_multiple_choice();
   84 
   85 if ( $abSpike eq "A" ) {
   86     $aText = "dashed, red curve";
   87     $bText = "solid, blue curve";
   88 
   89     $maxVel->qa("Which car attains the larger maximum velocity?", "A");
   90     $maxVel->makeLast("B");
   91 
   92     $firstStop->qa("Which stops first?", "A");
   93     $firstStop->makeLast("B");
   94 
   95     $distTrav->qa("Which travels farther?", "B");
   96     $distTrav->extra("A");
   97     $distTrav->makeLast("B");
   98 } else {
   99     $aText = "solid, blue curve";
  100     $bText = "dashed, red curve";
  101 
  102     $maxVel->qa("Which car attains the larger maximum velocity?", "B");
  103     $maxVel->extra("A");
  104     $maxVel->makeLast("B");
  105 
  106     $firstStop->qa("Which stops first?", "B");
  107     $firstStop->extra("A");
  108     $firstStop->makeLast("B");
  109 
  110     $distTrav->qa("Which travels farther?", "A");
  111     $distTrav->makeLast("B");
  112 }
  113 
  114 $spikeSide = ( $spikeLoc == 0.15 ) ? "left" : "right";
  115 
  116 TEXT(&beginproblem);
  117 Context()->texStrings;
  118 BEGIN_TEXT
  119 
  120 Two cars start at the same time and travel in the same direction along
  121 a straight road.  The figure below gives the velocity, \(v\) (in
  122 km/hr), of each car as a function of time (in hr).
  123 
  124 $PAR
  125 $BCENTER
  126 \{ image( insertGraph($gr), tex_size=>250, height=>150, width=>150,
  127     extra_html_tags=>'alt="graph of a tall, narrow spike ' .
  128     'graphed as a ' . $bText . ' centered to the ' .
  129     $spikeSide . ' of the graph, and a slightly shorter, ' .
  130     'broad downward opening curve graphed as a ' . $aText ) \}
  131 $ECENTER
  132 $PAR
  133 
  134 The velocity of car A is given by the $aText, and the velocity of car
  135 B by $bText.
  136 
  137 $PAR
  138 ${BBOLD}(a)$EBOLD
  139 
  140 \{ $maxVel->print_q() \}
  141 \{ $maxVel->print_a() \}
  142 
  143 $PAR
  144 ${BBOLD}(b)$EBOLD
  145 
  146 \{ $firstStop->print_q() \}
  147 \{ $firstStop->print_a() \}
  148 
  149 $PAR
  150 ${BBOLD}(c)$EBOLD
  151 
  152 \{ $distTrav->print_q() \}
  153 \{ $distTrav->print_a() \}
  154 
  155 END_TEXT
  156 Context()->normalStrings;
  157 
  158 ANS( radio_cmp( $maxVel->correct_ans() ) );
  159 ANS( radio_cmp( $firstStop->correct_ans() ) );
  160 ANS( radio_cmp( $distTrav->correct_ans() ) );
  161 
  162 Context()->texStrings;
  163 SOLUTION(EV3(<<'END_SOLUTION'));
  164 $PAR SOLUTION $PAR
  165 
  166 ${BBOLD}(a)$EBOLD
  167 $BR
  168 Car \{ $maxVel->correct_ans() \} has a velocity that attains the
  169 largest maximum value.
  170 
  171 $PAR
  172 ${BBOLD}(b)$EBOLD
  173 $BR
  174 The graph of the velocity of car \{ $firstStop->correct_ans() \}
  175 returns to zero first, so that car stops first.
  176 
  177 $PAR
  178 ${BBOLD}(c)$EBOLD
  179 $BR
  180 The area under the velocity curve for \{ $distTrav->correct_ans() \}
  181 is largest, so that car travels the farthest.
  182 
  183 END_SOLUTION
  184 Context()->normalStrings;
  185 
  186 ENDDOCUMENT();

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9