PREP 2014 Question Authoring - Archived

get new version error

get new version error

by Joel Trussell -
Number of replies: 1
I can't seem to get the problem below to get a variety of random values for the parameters. It always comes up with the first values in the "random" call. I thought I had duplicated the macros in a problem that behaves well and runs on the same server.  The problem is edited from a problem in the OPL, but I thought I had changed all the things that needed changed. 
Thanks for help

## DBsubject(Trigonometry)
## DBchapter(Trigonometric functions)
## DBsection(Sine & cosine functions - definitions, graphs, & properties)
## Institution(Univeristy of Utah)
## Author(Utah ww group)
## MLT(Amp_per_shift_formula)
## Level(2)
## TitleText1('Precalculus')
## AuthorText1('Ron Larson and Robert  Hostetler')
## EditionText1('7')
## Section1('.')
## Problem1('')
## KEYWORDS('algebra')

DOCUMENT();        # This should be the first executable line in the problem.

loadMacros(
 "PGstandard.pl",     # Standard macros for PG language
 "MathObjects.pl",
"PGcourse.pl",      # Customization file for the course
"PGchoicemacros.pl",
"PGanswermacros.pl",
 "AnswerFormatHelp.pl",
);


TEXT(beginproblem());
Context("Numeric");

Context()->variables->add(t=>'Real');
$showPartialCorrectAnswers = 1;

$a=random(2,1,9); # amplitude
$b=random(100,50,900); # frequency
$c=non_zero_random(-3.13,0.1,3.13); # phase shift
$d=non_zero_random(-9,1,9); # offset
$pi=2.0*acos(0.0);

Context()->texStrings;
BEGIN_TEXT
Knowledge of sinusoidal functions
$BR
Let
\[f(x)=$a \cos(2 \pi $b t + $c) + $d.\]
The amplitude of this function is
  \{ ans_rule(12) \}, 

$BR
its period is
  \{ ans_rule(12) \}, 

$BR
its phase shift is
  \{ ans_rule(12) \}, 

$BR
and its offset is
  \{ ans_rule(12) \}, 
END_TEXT

ANS(num_cmp( $a));
ANS(num_cmp( 1/$b));
ANS(num_cmp( $c));
ANS(num_cmp( $d));




ENDDOCUMENT();        # This should be the last executable line in the problem.

In reply to Joel Trussell

Re: get new version error

by Joel Trussell -
ARGH!  found the error 
$a=random(2,1,9);  should be $a=random(2,9,1);
I"m thinking C   2:1:9
sorry about that!!