Problem2
Jump to navigation
Jump to search
Prep Main Page > Web Conference 2 > Sample Problems > Problem 2
# DESCRIPTION # Sample problem for WeBWorK PREP workshop # Model problem: # Identify all points where the function f(x) = |x| + |x-1| is # non-differentiable. # WeBWorK problem written by Gavin LaRose, <glarose@umich.edu> # ENDDESCRIPTION DOCUMENT(); loadMacros( "PGstandard.pl", "PGchoicemacros.pl", "MathObjects.pl", ); ############################################################ # problem set-up Context("Numeric"); $showPartialCorrectAnswers = 1; # pick the points where we have the corner for the absolute value # functions $x0 = random(-3,-1,1); $x1 = random(1,3,1); # the function $f = Compute("abs(x-$x0) + abs(x-$x1)")->reduce(); # the points $points = List( Compute($x0), Compute($x1) ); ############################################################ # text TEXT(beginproblem()); Context()->texStrings; BEGIN_TEXT Identify all points where the function \(f(x) = $f\) is non-differentiable. ${BITALIC}(Enter your point or points as a comma-separated list. For example, if your answer is \(x = 3\) and \(x = 4\), you would enter ${BBOLD}3, 4$EBOLD.)$EITALIC $PAR Points \(x = \) \{ $points->ans_rule(25) \} END_TEXT Context()->normalStrings; ############################################################ # answer and solution ANS( $points->cmp() ); Context()->texStrings; SOLUTION(EV3(<<'END_SOLUTION')); $PAR SOLUTION $PAR The points of non-differentiability are \(x = $points\). END_SOLUTION Context()->normalStrings; ENDDOCUMENT(); # end of problem ############################################################