Difference between revisions of "ExplicitSequence1"

From WeBWorK_wiki
Jump to navigation Jump to search
(switch to PGML and remove answerFormatHelp.pl macro)
(add historical tag and give links to newer problems.)
 
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>
   

Latest revision as of 07:44, 18 July 2023

This article has been retained as a historical document. It is not up-to-date and the formatting may be lacking. Use the information herein with caution.

This problem has been replaced with a newer version of this problem

Sequences with Explicit Formulas

Click to enlarge

This PG code shows how to evaluate answers that are (possibly alternating) sequences with explicit formulas.


Templates by Subject Area

PG problem file Explanation

Problem tagging data

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 cos(pi * n) / n!, you should still restrict the domain to positive integers, because some students may simplify this to (-1)^n / n! and receive errors because the answer checker is substituting things such as n=0.5 into their formula.

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:

Templates by Subject Area