I am writing solutions for some problems and am using the form of "? {$var}" for a given value within BEGIN_SOLUTION.
I like the form of inserting a question mark "?" before the variable as it anticipates whether the sign of a value is positive or negative, However it has the troubling aspect of displaying values that are larger than 1000 in scientific notation:
That is 1250 is rendered as "1.25e + 03"
or worse 1320x is rendered as "1.32e + 03x"
These type of displays are confusing for the student when reading the step by step solutions. Is there a way to turn off the exponential display for values displayed in BEGIN_SOLUTION? I am assuming I can avoid converting it all to BEGIN_PGML_SOLUTION.
See Line 154 in the code below if you would like to see a reference.
# DESCRIPTION
## Calculus: Volumes by Cylindrical Shells
## ENDDESCRIPTION
## Tagged by XW
## DBsubject(Calculus - single variable)
## DBchapter(Applications of integration)
## DBsection(Volumes by disks)
## Date(6/5/2005)
## Institution(UVA)
## Author(Jeff Holt)
## Level(4)
## TitleText1('Calculus: Early Transcendentals')
## AuthorText1('Stewart')
## EditionText1('5')
## Section1('6.3')
## Problem1('35')
## TitleText2('Calculus: Early Transcendentals')
## AuthorText2('Stewart')
## EditionText2('6')
## Section2('6.3')
## Problem2('')
## TitleText3('Calculus: Early Transcendentals')
## AuthorText3('Rogawski')
## EditionText3('1')
## Section3('6.4')
## Problem3('9')
## KEYWORDS('calculus', 'integrals', 'volumes', 'cylindrical shells')
## Library/UVA-Stew5e/setUVA-Stew5e-C06S03-VolumesShells/6-3-35
DOCUMENT(); # This should be the first executable line in the problem.
loadMacros(
"PG.pl",
"PGbasicmacros.pl",
"PGchoicemacros.pl",
"PGanswermacros.pl",
"PGauxiliaryFunctions.pl"
);
TEXT(beginproblem());
#Context()->{format}{number} = "%.8g";
$showPartialCorrectAnswers = 1;
$a=random(-8, 8,1);
$b=random($a+2,10,1);
$p=$a*$b;
$s=-($a+$b);
$p1 =$p*(-1);
$s1 = $s*(-1);
$sp1 =$s1*$p1;
#$sp1 =sprintf("%0.0f",$sp);
$ss = $s1*$s1;
$pp =$p1*$p1;
$sps = $s*2;
$ppss = $ss +$p*2;
$sp2 = $sp1*2;
$soln = $PI*(-$a**5/30+$a**4 * $b/6 -$a**3 * $b**2/3 + $a**2 * $b**3/3 -$a*$b**4/6+$b**5/30);
$int1 = ($a +$b)/2;
$ch =floor($int1);
if ($ch == $a)
{
$int =$int1;
} else {
$int = $ch;
}
$ii = $int**2;
$b1 =$s*$int;
$ef1 = $ii +$b1+$p;
$aa5 = $a**5;
$aa4 = $a**4;
$aa3 = $a**3;
$aa2 = $a**2;
$bb5 = $b**5;
$bb4 = $b**4;
$bb3 = $b**3;
$bb2 = $b**2;
$cc5 = $bb5 -$aa5;
$cc4 = $bb4 -$aa4;
$cc3 = $bb3 -$aa3;
$cc2 = $bb2 -$aa2;
$cc1 = $b -$a;
$n4 = $cc4*$sps;
$n3 = $cc3*$ppss;
$n2 = $cc2*$sp2;
$n1 = $cc1*$pp;
$m5 = $cc5*12;
$m4 = $n4*15;
$m3 = $n3*20;
$m2 = $n2*30;
$m1 = $n1*60;
$nm = $m1+$m2+$m3+$m4+$m5;
$gc = gcd($nm,60);
if ($gc == 1)
{
$nm1 = $nm;
$nd1 = 60;
$anj1 = $nm*pi/60;
} else {
$nm1 = $nm/$gc;
$nd1 = 60/$gc;
$anj1 = $nm*pi/60;
}
$anj2 = sprintf("%0.3f",$anj1);
TEXT(EV2(<<EOT));
$BR
Find the volume of the solid obtained by rotating the function bounded by the
given curve about the \(x\)-axis.
$BR
\[ f(x) =x^2 ? {$s} x ? {$p} \]
$BR
Volume = \{ans_rule( 25) \}
$BR
EOT
ANS(num_cmp($soln));
BEGIN_SOLUTION
$BR
$BR
To find the volume of the solid that results from a rotation of \(f(x) =x^2 ? {$s} x ? {$p} \) about the \(x\)-axis we must find first find the points of intersection of the function to determine the limits of integration. Then integrate for the square of the function times \(\pi \) over the limits of intersection by applying the general from for the calculation of a solid: $BR
$BR
Volume = \( \displaystyle{ \pi \int_{\text{lower bound}}^{\text{ upper bound}} \left( f(x) \right)^2 \, dx} \) $BR
$BR
\(\begin{aligned}&\\
x^2 ? {$s} x ? {$p} & = 0 && \text{Set the function equal to zero and solve for }x.\\
(x -$a)(x - $b) & = 0 && \text{Factor the trinomial. }\\
\end{aligned}\)
$BR
Then the function \(f(x)\) intersects the \(x\) axis at \( x = $a \) and \( x = $b \).
$BR
Accordingly the volume of the bounded region can be found by integrating over the limits of integration: $BR
$BR
\(\displaystyle{ Volume = \pi \int_{$a}^{$b} \left( f(x) \right)^2 \, dx}\) $BR
$BR
Substitute the functions of \(f(x) \) into the volume equation: $BR
$BR
\(\displaystyle{ Volume = \pi \int_{$a}^{$b} \left( \left(x^2 ? {$s} x ? {$p} \right) \right)^2 \, dx}\) $BR
$BR
Square the quantity: $BR
$BR
\(\displaystyle{ Volume = \pi \int_{$a}^{$b} \left( x^2 ? {$s} x ? {$p} \right) \left( x^2 ? {$s} x ? {$p} \right)\, dx}\) $BR
$BR
\(\displaystyle{ Volume = \pi \int_{$a}^{$b} \left( x^4 ? {$s} x^3 ? {$p} x^2 ? {$s} x^3 ? {$ss} x^2 ? {$sp1} x ? {$p} x^2 ? {$sp1} x + {$pp}\right) \, dx}\) $BR
$BR
$BR
Collect like terms: $BR
$BR
\(\displaystyle{ Volume = \pi \int_{$a}^{$b} \left( x^4 ? {$sps} x^3 ? {$ppss} x^2 ? {$sp2}x + {$pp}\right) \, dx}\) $BR
$BR
$BR
Integrate term by term: $BR
$BR
\(\displaystyle{ Volume = \pi \left[ \frac{1}{5} x^5 +\frac{$sps}{4} x^4 +\frac{$ppss}{3} x^3 + \frac{$sp2}{2} x^2 + {$pp} x \right] \Big|_{$a}^{$b} }\) $BR
$BR
Evaluate term by term: $BR
$BR
\(\displaystyle{ Volume = \pi \left[ \frac{1}{5} \left($b^5-$a^5\right) +\frac{$sps}{4} \left($b^4 - $a^4\right) +\frac{$ppss}{3} \left($b^3 - $a^3\right) + \frac{$sp2}{2} \left($b^2 - $a^2\right) + {$pp} ($b - $a) \right] }\) $BR
$BR
Raise each base to its respective power: $BR
$BR
\(\displaystyle{ Volume = \pi \left[ \frac{1}{5} \left($bb5-$aa5\right) +\frac{$sps}{4} \left($bb4 - $aa4\right) +\frac{$ppss}{3} \left($bb3 - $aa3\right) + \frac{$sp2}{2} \left($bb2 - $aa2\right) + {$pp} ($b - $a) \right] }\) $BR
$BR
Gather terms for each quantity: $BR
$BR
\(\displaystyle{ Volume = \pi \left[ \frac{1}{5} \left($cc5\right) +\frac{$sps}{4} \left($cc4\right) +\frac{$ppss}{3} \left($cc3\right) + \frac{$sp2}{2} \left($cc2\right) + {$pp} ($cc1) \right] }\) $BR
$BR
Form single fractions: $BR
$BR
\(\displaystyle{ Volume = \pi \left[ \frac{$cc5}{5} +\frac{$n4}{4} +\frac{$n3}{3} + \frac{$n2}{2} + $n1 \right] }\)
$BR
$BR
Form common denominators: $BR
$BR
\(\displaystyle{ Volume = \pi \left[ \frac{$cc5}{5} \cdot \frac{12}{12} +\frac{$n4}{4} \cdot \frac{15}{15}+\frac{$n3}{3} \cdot \frac{20}{20} + \frac{$n2}{2} \cdot \frac{30}{30} + $n1 \cdot \frac{60}{60} \right] }\) $BR
$BR
Combine fraction factors: $BR
$BR
\(\displaystyle{ Volume = \pi \left[ \frac{$m5}{60} +\frac{$m4}{60} +\frac{$m3}{60} + \frac{$m2}{60} +\frac{$m1}{60} \right] }\) $BR
$BR
Combine into one fraction: $BR
$BR
\(\displaystyle{ Volume = \pi \left[ \frac{$m5 +$m4 +$m3+$m2+$m1}{60} \right] }\) $BR
$BR
Simplify the numerator: $BR
$BR
\(\displaystyle{ Volume = \pi \left[ \frac{$nm}{60} \right] }\) $BR
$BR
Reduce the fraction: $BR
$BR
\(\displaystyle{ Volume = \frac{$nm1 \pi}{$nd1} }\) cubic units $BR
$BR
\(\displaystyle{ Volume \approx $anj2 }\) cubic units. $BR
$BR
END_SOLUTION
ENDDOCUMENT(); # This should be the last executable line in the problem.