Problem11

From WeBWorK_wiki
Jump to navigation Jump to search

Prep Main Page > Web Conference 2 > Sample Problems > Problem 11

This is Library/Michigan/Chap2Sec1/Q17.pg

DOCUMENT();

loadMacros(
"PG.pl",
"PGbasicmacros.pl",
"PGchoicemacros.pl",
"PGanswermacros.pl",
"PGauxiliaryFunctions.pl",
"MathObjects.pl",
"parserNumberWithUnits.pl",
);

Context("Numeric");

## Do NOT show partial correct answers
$showPartialCorrectAnswers = 0;
TEXT(beginproblem());

$a1 = random(0.3,0.5,0.05);
$a2 = random(1.3,1.9,0.1);
$b  = ($a1-0)/0.2;
$c  = ($a2-$a1)/0.2;
$v  = ($b+$c)/2;

Context()->texStrings;
BEGIN_TEXT

Consider a car whose position, \( s\), is given by the table
$PAR
$BCENTER
\{begintable(7) \}
\{row("\(t\) (s)" ,0,0.2,0.4,0.6,0.8,1.0) \}
\{row("\(s\) (ft)",0,$a1,$a2,3.8,6.5,9.6) \}
\{endtable()\}
$ECENTER

$PAR
Find the average velocity over the interval \(0 \le t \le 0.2\).
$BR
average velocity = \{ ans_rule(8) \}
(include \{ helpLink("units") \})
$PAR
Estimate the velocity at \(t=0.2\).
$BR
velocity = \{ ans_rule(8) \}
(include \{ helpLink("units") \})

END_TEXT
Context()->normalStrings;

ANS(NumberWithUnits( $b, "ft/s" )->cmp() );

$bval = NumberWithUnits( $b, "ft/s" );
$cval = NumberWithUnits( $c, "ft/s" );
$vval = NumberWithUnits( $v, "ft/s" );
ANS(NumberWithUnits( $v, "ft/s" )->cmp( checker=>sub {
    my ( $correct, $student, $ansHash ) = @_;
    if ( $student == $correct || $student == $cval || $student == $bval ) {
	return 1;
    } else {
	return 0;
    } } ) );

Context()->texStrings;
SOLUTION(EV3(<<'END_SOLUTION'));
$PAR SOLUTION $PAR
The average velocity over the interval \(0 \le t \le 0.2\) is given by
$PAR
\(\frac{s(0.2)-s(0)}{0.2}=\frac{$a1}{0.2}=$b \) ft/s.
$PAR
The average velocity over the interval \(0.2 \le t \le 0.4\) is given by
$PAR
\(\frac{s(0.4)-s(0.2)}{0.2}=\frac{$a2-$a1}{0.2}=$c \) ft/s
$PAR
A reasonable estimate for the velocity at \(t=0.2\) is the average
\(\frac{1}{2}\cdot ($b+$c) = $v\) ft/s.
END_SOLUTION
Context()->normalStrings;

COMMENT('MathObject version');
ENDDOCUMENT();