Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions Contrib/AgnesScott/Calculus/BoxMaxVolumeFixedCostScaffold.pg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##DESCRIPTION
## Optimization - maximize volume of a box with closed top and fixed
## Optimization - maximize volume of a box with closed top and fixed
## cost. Uses GeoGebra HTML5 applet to display graph of volume
## function and an animation of the box as the base length is changed.
## Embedding of Geogebra applet uses https://github.com/Edfinity/ww_ggb_applet.
Expand All @@ -17,11 +17,11 @@
## MO(1)
## KEYWORDS('optimization', 'applications', 'derivative', 'Geogebra')

##############################################################
##############################################################
# Initialization
##############################################################

DOCUMENT();
DOCUMENT();

loadMacros(
"PGstandard.pl",
Expand Down Expand Up @@ -89,11 +89,11 @@ $CostChecker = sub {
if ($student == $AreaForm) {
Value->Error("This appears to be the surface area of the box, not the cost. See the Hint.");
} elsif ($student == $mixed) {
Value->Error("Your answer is close, but it appears that you may have mixed units with the budget cost in dollars and the box costs in cents.");
Value->Error("Your answer is close, but it appears that you may have mixed units with the budget cost in dollars and the box costs in cents.");
} elsif ($student == $correct/100) {
Value->Error("Your answer is close, but it appears that you may have expressed the cost of the box in dollars, not cents.");
Value->Error("Your answer is close, but it appears that you may have expressed the cost of the box in dollars, not cents.");
} elsif ($student == $openTop) {
Value->Error("It appears that you may not have included the top of the box. See the Hint.");
Value->Error("It appears that you may not have included the top of the box. See the Hint.");
} elsif ($student == $sideCostError1) {
Value->Error("It appears that you may not have used the correct number of sides of the box. See the Hint.");
} elsif ($student == $sideCostError2) {
Expand All @@ -109,15 +109,15 @@ $CostChecker = sub {
} elsif ($student != $correct) {
Value->Error("See the Hint.");
}
return 1;
return 1;
};

$VolumeChecker = sub {
my ($correct,$student,$ansHash) = @_;
my ($correct,$student,$ansHash) = @_;
if ($student != $correct) {
Value->Error("See the Hint.");
}
return 1;
return 1;
};

$maxVolumeChecker = sub {
Expand Down Expand Up @@ -147,18 +147,18 @@ TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
applet.evalCommand("C3 = $C3");
applet.evalCommand("A = $C");
}

encodedApp = "UEsDBBQACAgIADR7mFEAAAAAAAAAAAAAAAAWAAAAZ2VvZ2VicmFfamF2YXNjcmlwdC5qc0srzUsuyczPU0hPT/LP88zLLNHQVKiu5QIAUEsHCEXM3l0aAAAAGAAAAFBLAwQUAAgICAA0e5hRAAAAAAAAAAAAAAAAFwAAAGdlb2dlYnJhX2RlZmF1bHRzMmQueG1s7Zpbc9soFICft7+C0dPuQ2whS7aTidNJO7OznUnTnU2ms69YwjIbDFpAsZxfXwS6xpfGdlI7bfIQcTAg+M7hAAedv89mFNxjIQlnIwd2XAdgFvKIsHjkpGpyMnTeX7w7jzGP8VggMOFihtTICfKSVT0tdXyvn+ehJBk5IUVSktABCUUqrzJyIgeATJIzxq/RDMsEhfgmnOIZuuIhUqaVqVLJWbc7n8875fs6XMTdOFadTOoGdF+ZHDlF4kw316o075ninuvC7r+fr2zzJ4RJhViIHaDHEeEJSqmSOokpnmGmgFokeORMUhbmvbj+ioQDKBpjOnJYSqkDijojpx84F+9+O5dTPgd8/B8OdZ4SKa7KG6Gbl9E/f+SUCyBGjuf6DtA0NZyx+Y9oMkU61RkEtjRFCyzAPaL5zyYHpYqHpgGTO0FU4rKsftVnHmH7i1+UZ2RmKAKpsFYAdIBMMI5Myo7QNdpYGMVW7Z13CwxLQCiRqhrYlREqELDnLpOwbW5G4RoQ0H2M4iQ3vAOj0O0Rhm/UgmKgpiS8Y1hqYwsalfLEXySKcD5VbJ2EE6ZuyEPRh6CZa5oy2SdwM+yE00XMWUXv71KukA8s8S27CLieZ0QtdHowtF3b1nph0DNKC+CS+Wo9mj/on7oQ9qF3aBVuBpyzaxG2GTVieCDE7hr3cPApsZ5n6S6rkX1MxX0TZs93V/iIHwCjbvXA7mHJMDZ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14Fb2xnv+iLmfiSDUERhgLKbULqrHxxXRF0uOQ1DHlMupAS3vtp/vvDvhs/548PnMcHz7KOB549A5+vHh84+5/p94DHnwRZAduP4HY+EO1B+oBB8n1PhboD4EaCbARJHgG4GyD8CtB8gTEj/2JtSjPLd8LBDnYLee5pr4dGk5R+0dd2g8YMd7O6Tp/9ep+MNPPkuPA/jQP+PcIojnIeE0z/CeUg47wDm3e4IPCyY4lGCyY9gHjBuHsE8YNQ8gnkfMI8PhY8PhR/zk5Xjw66PTCXH5/SPTyfH5/R/iE62Xom7LLLVe6PVrV6KwyE4c+utuO0X+Ox2+6BvxW0LU+tF3bx2/Zdf50X91+/JgNga+Zx0Xqg3+ocfYf0/4VfQbL/9vUtu5Oats77ZZt13+3ab7D4xD/FOqxpWRTav9etRqXXe/JEGNF7G7MMbIbee+vbaX6cwXxp0f8fhy/8BUEsHCL3fb77ZCgAAk0IAAFBLAQIUABQACAgIADR7mFFFzN5dGgAAABgAAAAWAAAAAAAAAAAAAAAAAAAAAABnZW9nZWJyYV9qYXZhc2NyaXB0LmpzUEsBAhQAFAAICAgANHuYUXLYhAf6BAAAdCYAABcAAAAAAAAAAAAAAAAAXgAAAGdlb2dlYnJhX2RlZmF1bHRzMmQueG1sUEsBAhQAFAAICAgANHuYUUc5j6PjAgAABg0AABcAAAAAAAAAAAAAAAAAnQUAAGdlb2dlYnJhX2RlZmF1bHRzM2QueG1sUEsBAhQAFAAICAgANHuYUb3fb77ZCgAAk0IAAAwAAAAAAAAAAAAAAAAAxQgAAGdlb2dlYnJhLnhtbFBLBQYAAAAABAAEAAgBAADYEwAAAAA="
new WwGgbApplet('applet2', {
width: 716,
height: 362,
ggbBase64: encodedApp,
appletOnLoad: onLoad,
appletOnUpdate: onUpdate,
hideAnswers: false,
hideAnswers: false,
enableShiftDragZoom: false,
showResetIcon: true
});
});
</script>

END_SCRIPT
Expand All @@ -177,14 +177,14 @@ END_TEXT
BEGIN_PGML
## ##

You have a budget of $[$Cdollars] to construct a box with a square bottom and with a closed top.
The cost of the top of the box is [$C1] cents per square inch.
The cost of the bottom of the box is [$C2] cents per square inch.
You have a budget of $[$Cdollars] to construct a box with a square bottom and with a closed top.
The cost of the top of the box is [$C1] cents per square inch.
The cost of the bottom of the box is [$C2] cents per square inch.
The cost of the sides of the box is [$C3] cents per square inch.

In this problem you will find the size of the box that will maximize its volume when you use all of the budget of $[$Cdollars]. The graph above shows a plot of the volume as a function of the base length. Move the indicated point along the graph to visualize how the volume changes for different lengths of the square base, and use this to estimate the optimal size of the bottom square.

Click on Part 1 to open the section. Enter your answers for the two questions in Part 1, then click on Submit Answers. Once your answers are both correct, you will be able to open Part 2. When your answers to Part 2 are both correct, continue to Part 3 to find the optimal width and height for the box with maximum volume.
Click on Part 1 to open the section. Enter your answers for the two questions in Part 1, then click on Submit Answers. Once your answers are both correct, you will be able to open Part 2. When your answers to Part 2 are both correct, continue to Part 3 to find the optimal width and height for the box with maximum volume.

END_PGML

Expand All @@ -204,19 +204,19 @@ What is the cost of the box *in cents* in terms of [`x`] and [`h`]?

What is the volume of the box in terms of [`x`] and [`h`]?

[`V`] = [_________________________]{$volForm->cmp(checker=>$VolumeChecker)} cubic inches
[`V`] = [_________________________]{$volForm->cmp(checker=>$VolumeChecker)} cubic inches

END_PGML

BEGIN_PGML_HINT

The cost of a closed box is the sum of the cost of the square top, the cost of the square bottom, and the cost of the four sides of the box. The costs should be given in cents. The volume of the box is the area of the base times the height.
The cost of a closed box is the sum of the cost of the square top, the cost of the square bottom, and the cost of the four sides of the box. The costs should be given in cents. The volume of the box is the area of the base times the height.

END_PGML_HINT

BEGIN_PGML_SOLUTION

The cost of a closed box is the sum of the cost of the square top, the cost of the square bottom, and the cost of the four sides of the box. The top and bottom each has area [`x^2`]. Each side of the box has area [`xh`]. The cost of a closed box in cents is therefore [`C = [$C1]*x^2 + [$C2]*x^2 + ([$C3])(4xh) = [$C1*$C2]*x^2 + [$C3*4]xh`]. The volume of the box is [`V = x^2 h`].
The cost of a closed box is the sum of the cost of the square top, the cost of the square bottom, and the cost of the four sides of the box. The top and bottom each has area [`x^2`]. Each side of the box has area [`xh`]. The cost of a closed box in cents is therefore [`C = [$C1]*x^2 + [$C2]*x^2 + ([$C3])(4xh) = [$C1*$C2]*x^2 + [$C3*4]xh`]. The volume of the box is [`V = x^2 h`].

END_PGML_SOLUTION

Expand Down Expand Up @@ -247,7 +247,7 @@ Solve the cost equation for [`h`] and substitute into the volume formula to get
END_PGML_HINT

BEGIN_PGML_SOLUTION
The cost of the box in cents is [``[$C1]*x^2 + [$C2]*x^2 + 4([$C3])xh = [$C1*$C2]*x^2 + [$C3*4]xh = [$C]``] where the budget $[$Cdollars] has been coverted from dollars to cents.
The cost of the box in cents is [``[$C1]*x^2 + [$C2]*x^2 + 4([$C3])xh = [$C1*$C2]*x^2 + [$C3*4]xh = [$C]``] where the budget $[$Cdollars] has been converted from dollars to cents.
Solving this equation for [`h`] gives

>>[``
Expand Down Expand Up @@ -283,7 +283,7 @@ Use the derivative to find the width [`x`] that maximizes the volume.

What is the height of the box of maximum volume?

[`h`] = [_________]{$optimalHeight}
[`h`] = [_________]{$optimalHeight}

What is the volume of the box?

Expand Down Expand Up @@ -326,4 +326,4 @@ Scaffold::End();

COMMENT(' Note: Uses GeoGebra which might not be executed in the Library Browser. Uses scaffolding.');

ENDDOCUMENT();
ENDDOCUMENT();
Loading