## DESCRIPTION ## Calculus: Areas between Curves ## ENDDESCRIPTION ## KEYWORDS('calculus', 'integration', 'integrals', 'areas between curves') ## Tagged by XW ## DBsubject('Calculus') ## DBchapter('Applications of Integration') ## DBsection('Areas Between Curves') ## Date('6/5/2005') ## Author('Jeff Holt') ## Institution('UVA') ## TitleText1('Calculus') ## EditionText1('5e') ## AuthorText1('Stewart') ## Section1('6.1') ## Problem1('6') DOCUMENT(); # This should be the first executable line in the problem. loadMacros( "PG.pl", "PGbasicmacros.pl", "PGchoicemacros.pl", "PGanswermacros.pl", "PGauxiliaryFunctions.pl" ); TEXT(beginproblem()); $showPartialCorrectAnswers = 1;$a=random(2, 5); $add=random(1, 5);$b=$a+$add; $e = exp(1);$soln = ($e**$b)/$b-($e**$a)/$a-(1/$b)+(1/$a); TEXT(EV2(< [0,0], 'height' => 300, 'width' => 300 ); ($fun1_ref,$fun2_ref) = plot_functions ($graph,$fun1, $fun2 ); #Here Professor Gage uses a new routine for drawing non-functions (parametrically). #And replaces the first line. However, this doesnt work in the system version, #since the PGgraphmacros.pl (?) hasn't been updated there yet).$temp = new Fun (sub {$c;}, sub {my$x = shift; $c+($x)*($line1_finish_y -$c);}, $graph);$temp ->color('black'); $temp -> domain(0,1);$temp -> weight(2); # here I make the two vertical lines at x=$c and x=$b #line1 (x<0) #$graph->moveTo(@line1_start); #$graph->lineTo(@line1_finish); #line2 (x>0) $graph->moveTo(@line2_start);$graph->lineTo(@line2_finish); #where to put the labels #$label_lineN = new Label ($x,$y,$string,$color,@justification) #$string is the the text of the label, @justification can be: right, left or center. $labelx = -5 ;$y1 = $d*$c**2 ; $y2 =$d*$b**2 ;$label_fun1 = new Label ($labelx,&{$fun1_ref->rule}($labelx),"f(x)",'blue','left');$label_fun2 = new Label ($labelx,&{$fun2_ref->rule}($labelx),"g(x)",'blue','left'); # NOTE:$fRef->rule is a reference to the subroutine which calculates the function. It was # defined in the output of plot_functions. It is used here to calculate the y value of the # label corresponding to the function, and below to find the y values for the labels # corresponding to the first and second derivatives. $label_line1 = new Label ($c,$y1,"x=$c",'black','center'); $label_line2 = new Label ($b,$y2,"x=$b",'black','center'); #prints the labels $graph->lb($label_fun1,$label_fun2 ,$label_line1 ,$label_line2 ); TEXT(image( insertGraph($graph), 'width' => 175, 'height' => 175) ); TEXT(EV2(<