Difference between revisions of "Simple Sample Problem"

From WeBWorK_wiki
Jump to navigation Jump to search
(Created page with 'Prep Main Page > Web Conference 1 > Simple Sample Problem ############################################################ # DESCRIPTI…')
 
m (added tag)
 
Line 43: Line 43:
 
 
 
ENDDOCUMENT();
 
ENDDOCUMENT();
  +
  +
[[Category:PREP 2011]]

Latest revision as of 17:31, 16 June 2021

Prep Main Page > Web Conference 1 > Simple Sample Problem

############################################################
# DESCRIPTION
# Very simple sample problem for WeBWorK PREP workshop
# WeBWorK problem written by Gavin LaRose, <glarose@umich.edu>
# ENDDESCRIPTION

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

############################################################
# problem set-up
# 
Context("Numeric");
$a = random(2,8,1);
$f = Compute( "x^$a" );

############################################################
# text
#
TEXT(beginproblem());
Context()->texStrings;
BEGIN_TEXT
Find the derivative of \(f(x) = $f\):
$BR
\( f'(x) = \) \{ $f->ans_rule(10) \}
END_TEXT
Context()->normalStrings;

############################################################
# answer and solution
#
$fp = $f->D()
ANS( $fp->cmp() );

Context()->texStrings;
SOLUTION(EV3(<<'END_SOLUTION'));
$PAR SOLUTION $PAR
\( f'(x) = $fp \), by the power rule.
END_SOLUTION
Context()->normalStrings;

ENDDOCUMENT();