## PREP 2015 Question Authoring - Archived

### A follow up on presenting clean solution displays for messy problems.

by tim Payer -
Number of replies: 0
Hello all,

In the solution section of the 3rd problem below is a display that has some challenges to the clean display ethic. I really like the option to align lines of work in TeX and to affix each line with some text that explains the steps being applied to the student for the solution section of the problem. However for this particular problem I had to use a mix of bullet displays and aligned TeX because some portions of the TeX solution were so large that the text was pushed off my wide screen monitor. This problem would only become worse for students using hand held devices for their homework.

I purposely did not enter return for vertical spacing of blank lines between some of the lines of the solution so as to keep the formatting consistent. But I still think that a few pushes of the "Enter" key between the lines of work would improve the appearance of the display.

Any suggestions would be most appreciated. Thanks for the help on these.

The problem is pasted below:
# Webwork Workshop 2015  for Payer, Homework 1, Problem 4:
# Given a logistic function the student should be able to determine the
# the initial population, the population of some arbitrary input, and the inflection
# point.

DOCUMENT();
"MathObjects.pl",
"PGML.pl");

Context("Numeric");

$a = Real(random(2,13,1));$b = Real(random(2,9,1));
$c = Real(random(0.1,0.9,0.1));$d = Real(random(1,5,1));
$ex = Compute(-$d*$c);$b1 = Compute($b +1);$b2 = Compute($a/$b1);
$bc = ($b*$c);$bb = (2*$b);$abc = ($a*$b*$c);$abc2 = ($a*$b*$c*$c);
$ans1 =$a/(1+$b)*1000;$ans2 =($a*1000/(1+$b*(e)**(-$d*$c)));
$ans3 =ln($b)/$c; Context()->variables->add(t=>"Real"); TEXT(beginproblem()); BEGIN_PGML Public health records indicate that [t] weeks after the outbreak of a certain strain of influenza, the function of [f(t)] will estimate the number of persons who have contracted the flu in thousands. ###[f(t) = \frac{[$a]}{1+[$b]e^{-[$c]t}}] ###

1.  How many people had the flu initially?
[_____]{[$ans1]} 2. How many people had the flu at the end of week [$d]?
[_____]{[$ans2]} 3. When is the rate of infection increasing most rapidly? at [t] = [_____]{[$ans3]} weeks

END_PGML

BEGIN_PGML_SOLUTION
*SOLUTION*

1. The initial infected population occurred at time zero so we must evaluate [f(0) =?]
[\begin{aligned}&\\
f(0) &= \frac{[$a]}{1+[$b]e^{-[$c](0)}}\\ f(0) &= \frac{[$a]}{1+[$b]e^{0}}\\ f(0) &= \frac{[$a]}{1+[$b]*(1)} && \text{ Zero exponents bring the base to 1}\\ f(0) &= \frac{[$a]}{[$b1]} = [$b2]\\
f(0) &= [ans1] && \text{The answer has been adjusted for thousands} \end{aligned}] 2. Evaluate the function at week [d] to find the number of people with the flu at the end of week [d]. [\begin{aligned}&\\ f([d]) &= \frac{[$a]}{1+[$b]e^{-[$c]([$d])}}\\
f([$d]) &= \frac{[$a]}{1+[$b]e^{[$ex]}}\\
f([$d]) &= [$ans2] && \text{The answer has been adjusted for thousands}
\end{aligned}]

3.  To calculate the time when the rate of infection is increasing most rapidly recognize that a "rate" refers to the derivative, and "most rapidly" refers to the steepest rate which can be found at the point of inflection. So our goal is to find the second derivative and set it equal to zero and then solve for [t].
[\begin{aligned}&\\
f(t) &= \frac{[$a]}{1+[$b]e^{-[$c] t}}\\ f'(t) &= \frac{[$a]'(1+[$b]e^{-[$c] t})-[$a](1'+[$b](e^{-[$c] t})'(-[$c] t)')}{(1+[$b]e^{-[$c] t})^2} && \text{Apply the prime tics for the quotient rule and chain rule}\\
f'(t) &= \frac{(0)(1+[$b]e^{-[$c] t})-[$a](0-[$b]([$c])e^{-[$c] t})}{(1+[$b]e^{-[$c] t})^2} && \text{Apply the derivative}\\
f'(t) &= \frac{-[$a](-([$bc])e^{-[$c] t})}{(1+[$b]e^{-[$c] t})^2} = \frac{[$abc]e^{-[$c] t}}{(1+[$b]e^{-[$c] t})^2}&& \text{Reducing}\\ f'(t) &= [$abc]\left(\frac{e^{-[$c] t}}{(1+[$b]e^{-[$c] t})^2}\right) && \text{Prepare for the second derivative by pulling out the constant of }[$abc]
\end{aligned}]
*  Apply the  prime tics of the quotient and chain rules for the second derivative.
[f''(t) = [$abc]\left(\frac{(e^{-[$c] t})'(-[$c] t)'(1+[$b]e^{-[$c] t})^2-e^{-[$c] t}\left((1+[$b]e^{-[$c] t})^2\right)'(1'+[$b](e^{-[$c] t})'(-[$c] t)')}{(1+[$b]e^{-[$c] t})^4}\right)] * Apply the derivative. [f''(t) = [$abc]\left(\frac{-[$c] e^{-[$c] t}(1+[$b]e^{-[$c] t})^2-2e^{-[$c] t}\left(1+[$b]e^{-[$c] t}\right)(0-([$c])[$b]e^{-[$c] t})}{(1+[$b]e^{-[$c] t})^4}\right)]
* Reducing and reordering factors
[f''(t) = [$abc]\left(\frac{-[$c] e^{-[$c] t}(1+[$b]e^{-[$c] t})^2+2e^{-[$c] t}[$b]([$c])e^{-[$c] t}\left(1+[$b]e^{-[$c] t}\right)}{(1+[$b]e^{-[$c] t})^4}\right)] * Pulling the common factor of [([$c]) e^{-[$c] t}(1+[$b]e^{-[$c] t})] [f''(t) = [$abc]([$c]) e^{-[$c] t}(1+[$b]e^{-[$c] t})\left(\frac{-(1+[$b]e^{-[$c] t})+2e^{-[$c] t}([$b])}{(1+[$b]e^{-[$c] t})^4}\right)]
* Cancelling common factors and distributing negatives:
[f''(t) = [$abc2] e^{-[$c] t}\left(\frac{-1-[$b]e^{-[$c] t}+[$bb]e^{-[$c] t}}{(1+[$b]e^{-[$c] t})^3}\right)]
* Collecting like terms:
[f''(t) = [$abc2] e^{-[$c] t}\left(\frac{-1+[$b]e^{-[$c] t}}{(1+[$b]e^{-[$c] t})^3}\right)]
* Set the second derivative to zero. Recognize that the factors of [[$abc2] e^{-[$c] t}] are positive as is the denominator. Only the numerator quantity can bring the second derivative to zero. From here we solve for [t].
[\begin{aligned}&\\
-1+[$b]e^{-[$c] t} &= 0\\
[$b]e^{-[$c] t} &= 1\\
e^{-[$c] t} &= \frac{1}{[$b]}&& \text{divide by }[$b]\\ ln(e^{-[$c] t}) &= ln\left(\frac{1}{[$b]}\right)&& \text{Apply the natural log to both sides. }\\ -[$c] t &= ln\left([$b]^{-1}\right)&& \text{Use the rule of logs to reduce. }\\ -[$c] t &= -ln([$b])&& \text{Use the rule of logs to reduce. }\\ [$c] t &= ln([$b])&& \text{Cancel the negative}\\ t &= \frac{ln([$b])}{[$c]}&& \text{Divide by } [$c]\\
t &= [\$ans3]&& \text{The answer in weeks for when the flu is spreading most rapidly}
\end{aligned}]
END_PGML_SOLUTION

ENDDOCUMENT();