ExplicitSequence1: Difference between revisions
Jump to navigation
Jump to search
m (moved Sequences2 to ExplicitSequence1) |
(add historical tag and give links to newer problems.) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{historical}} | |||
<p style="font-size: 120%;font-weight:bold">This problem has been replaced with [https://openwebwork.github.io/pg-docs/sample-problems/Sequences/ExplicitSequence.html a newer version of this problem]</p> | |||
<h2>Sequences with Explicit Formulas</h2> | <h2>Sequences with Explicit Formulas</h2> | ||
Line 5: | Line 9: | ||
This PG code shows how to evaluate answers that are (possibly alternating) sequences with explicit formulas. | This PG code shows how to evaluate answers that are (possibly alternating) sequences with explicit formulas. | ||
</p> | </p> | ||
* | <!--* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Sequences/ExplicitSequence1.pg FortLewis/Authoring/Templates/Sequences/ExplicitSequence1.pg]--> | ||
* | * PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Sequences/ExplicitSequence1_PGML.pg FortLewis/Authoring/Templates/Sequences/ExplicitSequence1_PGML.pg] | ||
<br clear="all" /> | <br clear="all" /> | ||
Line 17: | Line 20: | ||
<tr valign="top"> | <tr valign="top"> | ||
<th> PG problem file </th> | <th style="width: 50%"> PG problem file </th> | ||
<th> Explanation </th> | <th> Explanation </th> | ||
</tr> | </tr> | ||
Line 43: | Line 46: | ||
DOCUMENT(); | DOCUMENT(); | ||
loadMacros( | loadMacros('PGstandard.pl','MathObjects.pl','PGML.pl','PGcourse.pl'); | ||
); | |||
TEXT(beginproblem()); | TEXT(beginproblem()); | ||
</pre> | </pre> | ||
Line 65: | Line 63: | ||
<td style="background-color:#ffffdd;border:black 1px dashed;"> | <td style="background-color:#ffffdd;border:black 1px dashed;"> | ||
<pre> | <pre> | ||
Context( | Context('Numeric'); | ||
Context()->variables->are(n=> | Context()->variables->are(n=>'Real'); | ||
$answer = Compute("(-1)^n / n!"); | $answer = Compute("(-1)^n / n!"); | ||
$answer->{test_points} = [[1],[2],[3],[4],[5],[6]]; | $answer->{test_points} = [[1],[2],[3],[4],[5],[6]]; | ||
$sequence = 'a_0=1, a_1 = -1, a_2 = \frac{1}{2}, a_3 = -\frac{1}{6}' | |||
. 'a_4 = \frac{1}{24}, a_5 = -\frac{1}{120}, \ldots'; | |||
</pre> | </pre> | ||
</td> | </td> | ||
Line 88: | Line 77: | ||
<b>Setup:</b> | <b>Setup:</b> | ||
We set the test points to be positive integers to avoid errors when evaluating the answer. Even if you expect students to enter answers such as <code>cos(pi * n) / n!</code>, you should still restrict the domain to positive integers, because some students may simplify this to <code>(-1)^n / n!</code> and receive errors because the answer checker is substituting things such as <code>n=0.5</code> into their formula. | We set the test points to be positive integers to avoid errors when evaluating the answer. Even if you expect students to enter answers such as <code>cos(pi * n) / n!</code>, you should still restrict the domain to positive integers, because some students may simplify this to <code>(-1)^n / n!</code> and receive errors because the answer checker is substituting things such as <code>n=0.5</code> into their formula. | ||
</p> | </p> | ||
</td> | </td> | ||
Line 100: | Line 86: | ||
<td style="background-color:#ffdddd;border:black 1px dashed;"> | <td style="background-color:#ffdddd;border:black 1px dashed;"> | ||
<pre> | <pre> | ||
BEGIN_PGML | |||
Find a formula for [` n^{th} `] term of the sequence [` [$sequence] `]. | |||
Find a formula for | |||
[` a_n = `] [__________________]{$answer} | |||
[@ helpLink('formulas') @]* | |||
END_PGML | |||
</pre> | </pre> | ||
<td style="background-color:#ffcccc;padding:7px;"> | <td style="background-color:#ffcccc;padding:7px;"> | ||
Line 117: | Line 100: | ||
</td> | </td> | ||
</tr> | </tr> | ||
<!-- Solution section --> | <!-- Solution section --> | ||
Line 139: | Line 105: | ||
<td style="background-color:#ddddff;border:black 1px dashed;"> | <td style="background-color:#ddddff;border:black 1px dashed;"> | ||
<pre> | <pre> | ||
BEGIN_PGML_SOLUTION | |||
Solution explanation goes here. | Solution explanation goes here. | ||
END_PGML_SOLUTION | |||
ENDDOCUMENT(); | ENDDOCUMENT(); | ||
Line 164: | Line 125: | ||
[[Category:Top]] | [[Category:Top]] | ||
[[Category: | [[Category:Sample Problems]] | ||
[[Category:Subject Area Templates]] |
Latest revision as of 11:44, 18 July 2023
This problem has been replaced with a newer version of this problem
Sequences with Explicit Formulas

This PG code shows how to evaluate answers that are (possibly alternating) sequences with explicit formulas.
- PGML location in OPL: FortLewis/Authoring/Templates/Sequences/ExplicitSequence1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros('PGstandard.pl','MathObjects.pl','PGML.pl','PGcourse.pl'); TEXT(beginproblem()); |
Initialization: |
Context('Numeric'); Context()->variables->are(n=>'Real'); $answer = Compute("(-1)^n / n!"); $answer->{test_points} = [[1],[2],[3],[4],[5],[6]]; $sequence = 'a_0=1, a_1 = -1, a_2 = \frac{1}{2}, a_3 = -\frac{1}{6}' . 'a_4 = \frac{1}{24}, a_5 = -\frac{1}{120}, \ldots'; |
Setup:
We set the test points to be positive integers to avoid errors when evaluating the answer. Even if you expect students to enter answers such as |
BEGIN_PGML Find a formula for [` n^{th} `] term of the sequence [` [$sequence] `]. [` a_n = `] [__________________]{$answer} [@ helpLink('formulas') @]* END_PGML |
Main Text: |
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT(); |
Solution: |