## MO(1)
# WeBWorK problem written by Alex Jordan 
# Portland Community College
#
# Template:
# Solve the following radical equation
#
#       (b-x)^3 = d
#
#
# Last updated: Spoddeck 11/12/15
# ENDDESCRIPTION


##############################################


DOCUMENT();

loadMacros(
  "PGstandard.pl",
  "MathObjects.pl",  
  "contextFraction.pl",
  "PGML.pl",
  "PGcourse.pl",
);


##############################################


TEXT(beginproblem());

Context("Numeric");
$var = list_random('a','b','c','d','h','k','m','n','p','q','r','t','v','w','x','y','z');
Context()->variables->are($var=>'Real');

$a = non_zero_random(-15,15,1);
$b = random(1,8,1);


$d = ($b-$a)**3;

$left = Formula("($b - $var)^3")->reduce;
$right = Formula("$d")->reduce;


$r[0] = Compute("$a");



Context("Interval");
Context()->parens->set('{'=>{type=>'Set'});
Context()->flags->set(formatStudentAnswer=>'parsed');
$ans = Compute("{$r[0]}");


##############################################


BEGIN_PGML

Solve the equation for [`[$var]`]. Enter the solution set using set notation.  For example: [`\{1,2\}`].

>>[``[$left] = [$right]``]<<


If you need to use a square root, type *sqrt(23)* for [`\sqrt{23}`] (for example).  
If the equation has no solutions, you can still use set notation by entering [`\{\}`].


The solution set is [__________]

END_PGML


##############################################


ANS( $ans->cmp(tolerance=>0));


##############################################


BEGIN_PGML_SOLUTION

In order to solve for [`[$var]`], we first take the cube root on both sides. Since this is an odd-numbered root, there will only be one answer.

    [``
\begin{aligned}
   [$left] &= [$right] \\
   \sqrt[3]{[$left]} &= \sqrt[3]{[$right]} \\
   [$b]-[$var] &= [$b-$a] \\
\end{aligned}
    ``]

Now we solve for [`[$var]`]:

    [``
\begin{aligned}
   [$b]-[$var] &= [$b-$a] \\
   [$b]-[$var]-[$b] &= [$b-$a]-[$b] \\
   -[$var] &= -[$a] \\
   [$var] &= [$a] \\
\end{aligned}
    ``]

The solution set is therefore [`\{[$r[0]]\}`]. Make sure to check your answer by substituting it into the original equation.

END_PGML_SOLUTION


##############################################


ENDDOCUMENT();
