oscarlevin / DMOI-webwork

A collection of original WeBWorK problems to accompany Discrete Mathematics: an Open Introduction by Oscar Levin
Other
2 stars 2 forks source link

Problem 2_6_1 error #4

Open scoskey opened 1 year ago

scoskey commented 1 year ago

Another term vs term+1 issue. I believe the following is correct.

## DBsubject(Algebra)
## DBchapter(Finite sequences and series)
## DBsection(Arithmetic)
## Level(3)
## KEYWORDS('discrete', 'sequences', 'arithmetics', 'summation', 'sum')
## TitleText1(Discrete Mathematics: an Open Introduction)
## EditionText1(3)
## AuthorText1(Oscar Levin)
## Section1(2.6)
## Problem1(1)
## Author(Oscar Levin)
## Institution(University of Northern Colorado)
## Language(en-US)

DOCUMENT();

####################
# Load Macros
####################
loadMacros(
  "PGstandard.pl",
  "MathObjects.pl",
  "PGML.pl",
  "AnswerFormatHelp.pl",
  "PGcourse.pl",
);

####################
# Header
####################
COMMENT('Authored in PreTeXt');
TEXT(beginproblem());

####################
# PG Setup
####################
do {$start = random(2,10);} until ($start !=3);
$roc = random(2,10);
do {$term = random(120,300);} until ($term%2 ==0);
#construct sequence
$a1 = $start + $roc;
$a2 = $start + 2*$roc;

$end = $start + $roc*$term;
$sum = $end+$start;
$ans = Compute("$sum*($term+1)/2");

####################
# Body
####################
BEGIN_PGML
Find [`[$start] + [$a1] + [$a2]+ \cdots + [$end]\text{.}`]

[_____]{$ans}

END_PGML

####################
# Solution
####################
BEGIN_PGML_SOLUTION
[`\frac{[$sum]\cdot [$term+1]}{2} = [$ans]\text{.}`]

END_PGML_SOLUTION

####################
# End Problem
####################
ENDDOCUMENT();
scoskey commented 1 year ago

It may be worth checking all problems similar to this one for term vs term+1 errors.