Difference between revisions of "Problem1"

From WeBWorK_wiki
Jump to navigation Jump to search
(Created page with ' # DESCRIPTION # Sample problem for WeBWorK PREP workshop # Model problem: # Find the equation of the parabola through (0,1), (1,0) and (2,0). # WeBWorK problem written by Ga…')
 
m
Line 1: Line 1:
  +
[[PREP_2011|Prep Main Page]] > [[PREP_2011_Web_Conference_II|Web Conference 2]] > [[SampleProblems|Sample Problems]] > Problem 1
  +
 
# DESCRIPTION
 
# DESCRIPTION
 
# Sample problem for WeBWorK PREP workshop
 
# Sample problem for WeBWorK PREP workshop

Revision as of 11:35, 19 May 2011

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

# DESCRIPTION
# Sample problem for WeBWorK PREP workshop
# Model problem:
# Find the equation of the parabola through (0,1), (1,0) and (2,0).
# WeBWorK problem written by Gavin LaRose, <glarose@umich.edu>
# ENDDESCRIPTION

DOCUMENT();

loadMacros(
"PGstandard.pl",
"PGchoicemacros.pl",
"MathObjects.pl",
);

############################################################
# problem set-up
Context("Numeric");
$showPartialCorrectAnswers = 0;

# pick a y-intercept, and the two x-intercepts
$yint = random(1,5,1);
$xint1 = random(1,3,1);
$xint2 = $xint1 + random(1,3,1);

# the parabola is then
$parab = Compute( "($yint/($xint1*$xint2))*(x-$xint1)*(x-$xint2)" );

############################################################
# text

TEXT(beginproblem());
Context()->texStrings;
BEGIN_TEXT

Find the equation of the parabola through the points
\((0, $yint)\), \(($xint1, 0)\) and \(($xint2, 0)\).
$PAR
\(y = \) \{ $parab->ans_rule(25) \}

END_TEXT
Context()->normalStrings;

############################################################
# answer and solution

ANS( $parab->cmp() );

Context()->texStrings;
SOLUTION(EV3(<<'END_SOLUTION'));
$PAR SOLUTION $PAR
Because the \(x\)-intercepts of the parabola are \(x=$xint1\)
and \(x=$xint2\), we know the parabola has the form
\[ y = k (x - $xint1) (x - $xint2).\]
To find \(k\), we plug in the given \(y\) intercept and solve:
\( $yint = k (-$xint1) (-$xint2) \), so that
\[ y = $parab. \]

END_SOLUTION
Context()->normalStrings;

ENDDOCUMENT();

# end of problem
############################################################