Hello, I am updating some old homework problems to include FormulaUpToConstant to prompt students to use the most general form of "+C" in their anti-derivatives.

I would like to require students to use fractions not decimals for their answer.

Also I would like that the "Correct Answer" to display fractions instead of decimals to match the students correct entry.

I attempted to use

Context("Fraction-NoDecimals");

But this resulted in a number of errors.

I have commented out the Context on line #48.

If you run the code block with this line un-commented you will see a number of complaints from webwork.

What is the correct approach to arrive at matching forms of fractions in the student's answer with the Correct Answer?

Any help is most appreciated...

## DESCRIPTION

## Determine an Indefinite Integral

## ENDDESCRIPTION

## Tagged by YJ

## DBsubject(Calculus - single variable)

## DBchapter(Integrals)

## DBsection(Indefinite integrals (without trigonometric functions))

## Date(5/26/2005)

## Updated for FormulaUpToConstant (7/2/2017)

## Institution(UVA)

## Author(Jeff Holt)

## MLT(indefinite_neg_exponent_single_term_not_logs)

## MLTleader(1)

## Level(2)

## TitleText1('Calculus: Early Transcendentals')

## AuthorText1('Stewart')

## EditionText1('5')

## Section1('5.4')

## Problem1('')

## TitleText2('Calculus: Early Transcendentals')

## AuthorText2('Stewart')

## EditionText2('6')

## Section2('5.4')

## Problem2('')

## KEYWORDS('calculus', 'integral', 'indefinite')

## Library/ASU-topics/setAntiderivatives/6-1-45

DOCUMENT();

loadMacros(

"PG.pl",

"MathObjects.pl",

"PGbasicmacros.pl",

"PGchoicemacros.pl",

"PGanswermacros.pl",

"PGauxiliaryFunctions.pl",

"contextFraction.pl",

"parserFormulaUpToConstant.pl",

"PGML.pl",

);

TEXT(beginproblem());

$showPartialCorrectAnswers = 1;

#Context("Fraction-NoDecimals");

$a = random(6,18,2);

$b = random(3,5,1);

$F = FormulaUpToConstant( "((1/$a)*x**(-$b+1))/(-$b+1) + C" );

BEGIN_PGML

Evaluate the indefinite integral for the most general solution:

[`` \int \frac{dx}{[$a] x^{[$b]}} = ``] [___]{$F->cmp()}{30}

END_PGML

BEGIN_SOLUTION

$BR

$BR

To evaluate the indefinite integral of \(\displaystyle{ \int \frac{dx}{$a x^{$b}}}\) use the anti-power rule that adds one to each exponent and divides each coefficient by the factor of each respective incremented exponent.$BR.

$BR

\(\begin{aligned}&\\

F(x) & = \frac{1}{$a}\int \frac{dx}{x^{$b}} && \text{First pull the constant. }\\

F(x) & = \frac{1}{$a}\int x^{-$b} \, dx && \text{Convert denominator bases with negative exponents. }\\

F(x) & = \frac{1}{$a} \frac{1}{1-$b} x^{1-$b} +C && \text{Add one to the exponent and divide by this value. }\\

F(x) & = \frac{-1}{\{$a*($b-1)\}} x^{\{1-$b\}} +C && \text{Combine fractions and reduce. }\\

\end{aligned}\)

$BR

END_SOLUTION

ENDDOCUMENT();