Greetings,
I am trying to display a data table in column format within a homework problem. I would like to have text on the left and a data table displayed on the right. Unfortunately I am missing something in the display of the data table.
Could you let me know where I have gone wrong?
Many thanks, Tim
The error messages are as follows:
Use of uninitialized value within @alignmentcolumns in numeric ne (!=) at line 369 of [PG]/macros/niceTables.pl
Use of uninitialized value $footerline in string ne at line 588 of [PG]/macros/niceTables.pl
The Code for the problem is below:
# DESCRIPTION Normal probability and Continuity Correction
# Find the associated probability given mu and sigma.
# Use correct notation.
# WeBWorK problem written by TimPayer <tsp1@humboldt.edu>
# ENDDESCRIPTION
## DBsubject(Probability)
## DBchapter(Random variables)
## DBsection(Expectation)
## Institution(Humboldt State University)
## Author(Tim Payer)
## KEYWORDS(probability, translate, notation)
DOCUMENT();
loadMacros(
"PGstandard.pl",
"PGunion.pl",
"PGnumericalmacros.pl",
"PGstatisticsmacros.pl",
"MathObjects.pl",
"parserPopUp.pl",
"PGML.pl",
"unionTables.pl",
"niceTables.pl",
"PGcourse.pl",
"weightedGrader.pl"
);
install_weighted_grader();
#Text(beginproblem()); #uncomment
install_problem_grader(~~&std_problem_grader);
$showPartialCorrectAnswers = 1;
Context("Numeric");
Context()->flags->set(
tolerance => 0.0001,
tolType => "absolute",
);
## Problem 9.4 ##
$L = random(20, 40, 1);
$N = list_random(20, 25, 40, 50, 100, 125);
if($N == 20 || $N == 25)
{
$Lo =random(2.5, 3.5, 0.5);
$Hi =random(4, 5.5, 0.5);
} elsif($N == 40)
{
$Lo =random(1.5, 3.0, 0.5);
$Hi =random(4, 5.5, 0.5);
} elsif( $N == 50)
{
$Lo =random(1, 2.5, 0.5);
$Hi =random(3.5, 5.5, 0.5);
} else {
$Lo =0.5;
$Hi =random(2.5, 5.5, 0.5);
}
## Problem 9.4a ##
$popup1 = PopUp(
["Choose:", $Lo - 0.5, $Lo, $Lo + 0.5, ($Lo - 0.5)/10, $Lo/10, ($Lo + 0.5)/10,($Lo - 0.5)/100, $Lo/100, ($Lo + 0.5)/100 ], $Lo/100);
$popup2 = PopUp(
["Choose:", $Hi - 0.5, $Hi, $Hi + 0.5, ($Hi - 0.5)/10, $Hi/10, ($Hi + 0.5)/10,($Hi - 0.5)/100, $Hi/100, ($Hi + 0.5)/100 ], $Hi/100);
$popup3 = PopUp(
["Choose:", $Lo - 0.5, $Lo, $Lo - 0.05, $Lo/100 - 0.5/100, $Lo/100, $Lo/100 - 0.5/$N, ($Lo - 0.05)/100, ($Lo - 0.05)/$N, ($Lo - 0.5)/$N ], $Lo/100 - 0.5/$N);
$popup4 = PopUp(
["Choose:", $Hi + 0.5, $Hi, $Hi + 0.05, $Hi/100 + 0.5/100, $Hi/100, $Hi/100 + 0.5/$N, ($Hi + 0.05)/100, ($Hi + 0.05)/$N, ($Hi + 0.5)/$N ], $Hi/100 + 0.5/$N);
$zlo = Compute("($Lo/100 - 0.5/$N-1/$L)/sqrt((1/$L)*(1-1/$L)/$N)");
$zlo2 =sprintf("%0.2f",$zlo);
$zl2 = Compute("$zlo2");
$zhi = Compute("($Hi/100 + 0.5/$N-1/$L)/sqrt((1/$L)*(1-1/$L)/$N)");
$zhi2 =sprintf("%0.2f",$zhi);
$zh2 = Compute("$zhi2");
$p = normal_prob($zl2, $zh2, mean=>0, deviation=>1);
#### Begin Problem...
$column1 = PGML::Format(<<END_PGML);
*Drawn from Lecture Notes: Week 5 Day 2.*
*9.4)* The fiddler crab gets its name for the having a single over-sized claw. The male fiddler crab uses its over-sized claw to fight other males for territory and to attract females.
END_PGML
$column2 ="Italic text: $BITALIC Uca vocans vomeris $EITALIC ".DataTable(
[
[['p-values from R: ', ], 'Scientific Notation:','Scientific Notation for Webwork:'],
[[' p = 0.8576' ],' \(8.58 \times 10^{-1}\) ',' 8.58E-1 '],
[[' p = 0.004237' ],' \(4.24 \times 10^{-3}\)', '4.24E-3 '],
[[' p = 7.526e-04' ],' \(7.53 \times 10^{-4}\)', '7.53E-4 '],
],
caption => ' Note! Express all p-values in scientific notation. Use a capital "E" with three significant digits.',
midrules => 1,
align => '|p{3.5in}|p{2in}|p{2}|',
);
TEXT(ColumnTable($column1,$column2));
BEGIN_PGML
In most species of fiddler crabs the proportions of "right-clawed" and "left-clawed" individuals are roughly equal. But in one particular species, _Uca vocans vomeris_, the left-clawed individuals are strongly outnumbered. In this species the incidence of left clawed fiddler crabs ranges between about 1% to 4%. Patricia R.Y. Backwell of the Australian National University in Canberra and her colleagues studied the fighting ability of these left-clawed crabs. Their findings show that the lefties are less likely to fight and more likely to lose when they did fight. Blackwell et al were puzzled as to why the small proportion of lefties among _U.vomeris_ persists if there appears to be no evolutionary advantage. They suggest further study to answer the question as to what advantage the species would have in maintaining a small population of left clawed individuals that are poor fighters.
Source: Henry Fountain, science writer, New York Times, Section F3: "In a Righty World, Left Clawed Crabs are at a Loss", September 4, 2007.
*9.4a)* Given that one out of every [$L] crabs of a population of _Uca vocans vomeris_ are left clawed, what is the probability that a random sample of [$N] _U.vomeris_ will have between [$Lo]% and [$Hi]% (inclusive) left clawed crabs?
Let [``\Large{\hat p}``] = The sample proportion of left clawed crabs from a random draw of [$N] _U.vomeris_.
Direct translation:
[``\Large{P(} ``] [$popup1->menu]* [``\Large{\le \hat p \le}``] [$popup2->menu]* [``\Large{ ) \, \approx }``]
Continuity correction if needed:
[``\Large{P(} ``] [$popup3->menu]* [``\Large{\le \hat p \le}``] [$popup4->menu]* [``\Large{ ) \, \approx }``]
Complete the notation translation using the closest second decimal Z-score approximation with a fourth decimal probability answer:
[``\Large{P(} ``] [_____][``\Large{\le Z \le}``] [_____] [``\Large{) \, \approx }``] [_____]
END_PGML
#Adapted weighted answers values:
## Problem 9.4a ##
WEIGHTED_ANS( ($popup1)->cmp, 2 );
WEIGHTED_ANS( ($popup2)->cmp, 2 );
WEIGHTED_ANS( ($popup3)->cmp, 8 );
WEIGHTED_ANS( ($popup4)->cmp, 8 );
WEIGHTED_ANS( ($zl2)->cmp, 35 );
WEIGHTED_ANS( ($zh2)->cmp, 35 );
WEIGHTED_ANS( ($p)->cmp, 10 );
BEGIN_PGML_SOLUTION
The correct answers are coming....in 2017, Hah!
END_PGML_SOLUTION
ENDDOCUMENT();