-
-
Notifications
You must be signed in to change notification settings - Fork 77
New sample problems and updates #1201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pstaabp
wants to merge
6
commits into
openwebwork:PG-2.20
Choose a base branch
from
pstaabp:new-sample-problems-and-updates
base: PG-2.20
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cdddbde
updated sample problems.
pstaabp 07e2ef9
Added new Sample Problems
pstaabp 5ce1dc4
Update the Vector graph tool as the functionality recently changed.
pstaabp 373ae73
Some cleanup of the wording and restoring some formatting.
pstaabp 9e20a63
Trimed pg problems to max width of 80 charactors.
pstaabp f49077d
Clean up the documentation language.
pstaabp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
## DESCRIPTION | ||
## Answer is a number or formula with units | ||
## ENDDESCRIPTION | ||
|
||
## DBsubject(WeBWorK) | ||
## DBchapter(WeBWorK tutorial) | ||
## DBsection(PGML tutorial 2015) | ||
## Date(02/15/2025) | ||
## Institution(Fitchburg State University) | ||
## Author(Peter Staab) | ||
## Static(1) | ||
## MO(1) | ||
## KEYWORDS('differential calculus', 'units') | ||
|
||
# Update 2025.02 to use the contextUnits.pl macro. | ||
|
||
#:% name = Unit Conversion | ||
#:% type = Sample | ||
#:% subject = arithmetic | ||
#:% categories = [units] | ||
|
||
#:% section = preamble | ||
#: We load `contextUnits.pl` in order to use the Units context. | ||
DOCUMENT(); | ||
|
||
loadMacros('PGstandard.pl', 'PGML.pl', 'contextUnits.pl', 'PGcourse.pl'); | ||
|
||
#:% section = setup | ||
#: The Units context is from the PODLINK('contextUnits.pl') macro. | ||
#: This is related to the 'Numeric' context with the ability to handle units. | ||
#: The first question involves volume units so we set that. | ||
#: | ||
#: The `->toUnits` method converts the given number with units to the | ||
#: requested unit. | ||
#: | ||
#: The second part below is a different conversion question, so the line | ||
#: `Context('Units')->withUnitsFor('length', 'time');` resets the contxt with | ||
#: a new set of units. | ||
Context('Units')->withUnitsFor('volume'); | ||
|
||
$v = random(25, 200, 25); | ||
$vol = Compute("$v ml"); | ||
$vol_cups = $vol->toUnits('cup'); | ||
|
||
Context('Units')->withUnitsFor('length', 'time'); | ||
|
||
$s = random(22, 110, 11); | ||
$speed = Compute("$s ft/s"); | ||
$speed_mph = $speed->toUnits('mi/h'); | ||
|
||
#:% section = statement | ||
#: The `with(sameUnits =>1)` requires the student answer to be in the same | ||
#: units. Use `helpLink('units')` for students to have access to the complete | ||
#: list of units that WeBWorK understands. | ||
BEGIN_PGML | ||
Perform the following unit conversions: | ||
|
||
a) Convert [$vol] to cups. You may use [`1\;\text{l} = 1000\;\text{ml}`], | ||
[`1\;\text{qt} = 0.9464\;\text{l}`] and [`1\;\text{qt}=4\;\text{cups}`]. | ||
|
||
Answer: [_]{$vol_cups->with(sameUnits => 1)} | ||
|
||
b) Convert [$speed] to miles per hour. Recall that | ||
[`1\;\text{mile}=5280\;\text{feet}`]. | ||
|
||
Answer: [_]{$speed_mph->with(sameUnits => 1)} | ||
|
||
Note: use units in all answers. [@ helpLink('units') @]* | ||
END_PGML | ||
|
||
#:% section = solution | ||
BEGIN_PGML_SOLUTION | ||
Using dimensional analysis: | ||
|
||
a) [``` | ||
[$vol] \cdot \frac{1\;\text{l}}{1000\;\text{ml}} | ||
\cdot \frac{1\;\text{qt}}{0.9464\;\text{l}} | ||
\cdot \frac{4\;\text{cups}}{1\;\text{qt}} = [$vol_cups] | ||
```] | ||
|
||
b) [``` | ||
[$speed] \cdot \frac{1\;\text{mile}}{5280\;\text{ft}} | ||
\cdot \frac{3600\;\text{sec}}{1\;\text{hr}} = [$speed_mph] | ||
```] | ||
END_PGML_SOLUTION | ||
|
||
ENDDOCUMENT(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
## DESCRIPTION | ||
## Shows a triangle tool within the GraphTool. | ||
## ENDDESCRIPTION | ||
|
||
## DBsubject(WeBWorK) | ||
## DBchapter(Sample Problems) | ||
## DBsection(Graph Tool) | ||
## Date(02/25/2025) | ||
## Institution(Missouri Western) | ||
## Author(Glenn Rice) | ||
## MO(1) | ||
## KEYWORDS('graph tool', 'vectors') | ||
|
||
#:% name = Line Segment Graph Tool | ||
#:% type = Sample | ||
#:% subject = [geometry] | ||
#:% categories = [graph, graphtool] | ||
#:% see_also = [VectorGraphTool.pg, TriangleGraphTool.pg, QuadrilateralGraphTool.pg] | ||
|
||
#:% section = preamble | ||
#: Load the PODLINK('parserGraphTool.pl') macro to be able to use the GraphTool. | ||
DOCUMENT(); | ||
|
||
loadMacros('PGstandard.pl', 'PGML.pl', 'parserGraphTool.pl', 'PGcourse.pl'); | ||
|
||
#:% section = setup | ||
#: The graph tool is created with the correct answer | ||
#: `{ segment, solid, ($sx1, $sy1), ($sx2, $sy2) }`, with unique points | ||
#: `($sx1, $sy1)` and `($sx2, $sy2)`. For a correct answer, the line segment | ||
#: must have the given the endpoints and be solid. | ||
#: | ||
pstaabp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#: Mulitple line segments can be added to the graph tool, however, if a | ||
#: triangle or quadrilateral is desired, see PROBLINK('TriangleGraphTool.pg') | ||
#: and PROBLINK('QuadrilateralGraphTool.pg') for more appropriate tools. | ||
$sx1 = random(-8, 8); | ||
$sy1 = random(-8, 8); | ||
do { $sx2 = random(-8, 8); $sy2 = random(-8, 8); } | ||
until $sx2 != $sx1 || $sy2 != $sy1; | ||
|
||
$gt = GraphTool("{segment, solid, ($sx1, $sy1), ($sx2, $sy2)}",) | ||
->with(availableTools => [ 'SegmentTool', 'FillTool', 'SolidDashTool' ]); | ||
|
||
#:% section = statement | ||
#: This asks the student to graph the line segment with the given endpoints. | ||
#: The code `[_]{$gt}` inserts the graph tool. | ||
BEGIN_PGML | ||
Graph the line segment between the points [`([$sx1], [$sy1])`] and | ||
[`([$sx2], [$sy2])`]. | ||
|
||
[_]{$gt} | ||
END_PGML | ||
|
||
#:% section = solution | ||
#: To show the graph with alternate text we use the PGML image construct | ||
#: `[! !]{$gt}`, where the alternate text is placed within the `[! !]`. | ||
BEGIN_PGML_SOLUTION | ||
The correct answer is | ||
|
||
[!A graph of the line segment from ([$sx1], [$sy1]) to ([$sx2],[$sy2])!]{$gt} | ||
END_PGML_SOLUTION | ||
|
||
ENDDOCUMENT(); |
64 changes: 64 additions & 0 deletions
64
tutorial/sample-problems/Geometry/QuadrilateralGraphTool.pg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
## DESCRIPTION | ||
## Shows a quadrilateral tool within the GraphTool. | ||
## ENDDESCRIPTION | ||
|
||
## DBsubject(WeBWorK) | ||
## DBchapter(Sample Problems) | ||
## DBsection(Graph Tool) | ||
## Date(02/25/2025) | ||
## Institution(Missouri Western) | ||
## Author(Glenn Rice) | ||
## MO(1) | ||
## KEYWORDS('graph tool', 'quadrilateral') | ||
|
||
#:% name = Quadrilateral Graph Tool | ||
#:% type = Sample | ||
#:% subject = [geometry] | ||
#:% categories = [graph, graphtool] | ||
|
||
#:% section = preamble | ||
#: Load the PODLINK('parserGraphTool.pl') macro to be able to use the GraphTool. | ||
DOCUMENT(); | ||
|
||
loadMacros('PGstandard.pl', 'PGML.pl', 'parserGraphTool.pl', 'PGcourse.pl'); | ||
|
||
#:% section = setup | ||
#: This finds four unique random points and sets up the GraphTool. The line | ||
#: `{ quadrilateral, solid, ($x1, $y1), ($x2, $y2), ($x3, $y3), ($x4, y4) }` | ||
#: creates a quadrilateral with solid line edges and the given four points. | ||
$x1 = random(-8, 8); | ||
$y1 = random(-8, 8); | ||
do { $x2 = random(-8, 8); $y2 = random(-8, 8) } until $x2 != $x1 || $y2 != $y1; | ||
do { $x3 = random(-8, 8); $y3 = random(-8, 8) } | ||
until ($y3 - $y1) * ($x2 - $x1) != ($y2 - $y1) * ($x3 - $x1); | ||
do { $x4 = random(-8, 8); $y4 = random(-8, 8) } | ||
until ($y4 - $y1) * ($x2 - $x1) != ($y2 - $y1) * ($x4 - $x1) | ||
&& ($y4 - $y1) * ($x3 - $x1) != ($y3 - $y1) * ($x4 - $x1) | ||
&& ($y4 - $y1) * ($x3 - $x2) != ($y3 - $y2) * ($x4 - $x2); | ||
|
||
$gt = GraphTool( | ||
"{quadrilateral, solid, ($x1, $y1), ($x2, $y2), ($x3, $y3), ($x4, $y4)}") | ||
->with( | ||
availableTools => [ 'QuadrilateralTool', 'FillTool', 'SolidDashTool' ]); | ||
#:% section = statement | ||
#: This asks the student to graph a quadrilateral with the given vertices. | ||
#: The code `[_]{$gt}` inserts the graph tool. | ||
BEGIN_PGML | ||
Graph the quadrilateral with vertices [`([$x1], [$y1])`], [`([$x2], [$y2])`], | ||
[`([$x3], [$y3])`], and [`([$x4], [$y4])`] in that order. | ||
|
||
[_]{$gt} | ||
END_PGML | ||
|
||
#:% section = solution | ||
#: To show the graph with alternate text we use the PGML image construct | ||
#: `[! !]{$gt}`, where the alternate text is placed within the `[! !]`. | ||
$alt_text = "A graph of the quadrilateral with vertices ($x1, $y1), ($x2,$y2), " | ||
. "($x3, $y3),and ($x4, $y4)"; | ||
BEGIN_PGML_SOLUTION | ||
The correct answer is | ||
|
||
[![$alt_text]!]{$gt} | ||
END_PGML_SOLUTION | ||
|
||
ENDDOCUMENT(); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to get into the habit of adding changelog comments to some of these examples? I don't initially see the point to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also did not like that this comment was added. It should be removed.