## WeBWorK Problems

### \tilde x is rendering as \bar x in PGML

by tim Payer -
Number of replies: 2
Greetings,

Has anyone noticed a rendering problem for LaTeX?

I have "\tilde x" rendering as "\bar x" within PGML.
And it is a slightly shorter bar at that.

Can you recommend a solution so that tilde will render?

The code block is below, Thanks

# DESCRIPTION
# Stat 109 Data summarization
# WeBWorK problem written by TimPayer <tsp1@humboldt.edu>
# ENDDESCRIPTION

## DBsubject(Statistics)
## DBchapter(Exploratory data analysis/descriptive statistics)
## DBsection(Summary statistics)
## Institution(Humboldt State University)
## Author(Tim Payer)
## KEYWORDS(summations, mean, sd)

DOCUMENT();
"PGstandard.pl",
"PGbasicmacros.pl",
"MathObjects.pl",
"PGML.pl",
"niceTables.pl",
"parserFormulaUpToConstant.pl"
);

Context("Numeric");
$showPartialCorrectAnswers = 1; ## The beginning of 2.1 Stat 109 problem: ## Given 10 values (at random) find the mean and median.$parsum = 0;
@count = ();
foreach my $i (1..12) {$count [$i] = random(14.8, 16.0,0.1);$sum = Compute("$count[$i] + $parsum");$parsum = $sum; } # @count = sort{$a <=> $b} @count; ## Code blocks used to sort an array.. #sub num_sort { # PGsort sub {$_[0] <=> $_[1]}, @_; # } #@out_array = num_sort(@count); #$a = 3;
#do {
#    $a =$a + 1;
#} until ( $a == 10 ); ## For a randomized sample that gives each student a different random sample, ## un-comment(#) the loop above. For a fixed sample that permit each student to share ## a common answer, comment out the loop above and un-comment the 10 ## line of code below. #$count [1] = 13.1;
#$count [2] = 15.2; #$count [3] = 14.2;
#$count [4] = 6; #$count [5] = 9;
#$count [6] = 18; #$count [7] = 20;
#$count [8] = 23; #$count [9] = 11;
#$count [10] = 12; #$count [11] = 12;
#$count [12] = 12; # Edit answers soon....$ans1 = Compute("$sum/12 ");$ans2 = Compute("($count[6] +$count[7])/2 ");

BEGIN_PGML

2.1)  Beall et al. 2002, made an extensive survey of hemoglobin levels (g/dL) among male populations living at different elevations. Given that the concentration of oxygen at high elevations ( above 18,000 feet) is less than half that found at sea level, Beall's suspected that men living at higher elevations should have higher hemoglobin levels to compensate for the thinner air. As a base line for comparison, hemoglobin levels from over 1700 men living at sea level in the USA was recorded. A random sample of twelve of these hemoglobin levels are tallied in the table below.

Determine the mean and following five boxplot values to summarize the twelve data points.

Source: Data set drawn from Beall et al. 2002, from the text: "The Analysis of Biological Data", Whitlock and Shluter, 2nd ed. 2015.

[@DataTable(
[
[ ["".PGML::Format('[\text{Subject}]')."",
halign  => 'r|',
rowcss  => 'border-bottom: 2px solid;',
cellcss => 'border-top: 2px solid;
border-left: 2px solid;
border-right: 2px solid; ',],
["".PGML::Format('[\text{Hemoglobin: g/dL}]')."",
rowcss  => 'border-bottom: 2px solid;',
cellcss => 'border-top: 2px solid;
border-right: 2px solid; ',],
],
[ ["1",
midrule => '1',
rowcss  => 'border-bottom: 1px solid;',
cellcss => 'border-bottom: 1px solid;
border-left: 1px solid;
border-right: 1px solid; ',],
["".PGML::Format('[[count[1]]]')."", rowcss => 'border-bottom: 1px solid;', cellcss => 'border-top: 1px solid; border-right: 1px solid; ',], ], [ ["2", halign => '|r|', rowcss => 'border-bottom: 1px solid;', cellcss => 'border-left: 1px solid; border-right: 1px solid; ',], ["".PGML::Format('[[count[2]]]')."",
colspan => '1',
halign  => 'c|',
rowcss  => 'border-bottom: 1px solid;',
cellcss => 'border-right: 1px solid; ',],
],
[ ["3",
midrule => '1',
rowcss  => 'border-bottom: 1px solid;',
cellcss => 'border-bottom: 1px solid;
border-left: 1px solid;
border-right: 1px solid; ',],
["".PGML::Format('[[count[3]]]')."", rowcss => 'border-bottom: 1px solid;', cellcss => 'border-top: 1px solid; border-right: 1px solid; ',], ], [ ["4", halign => '|r|', rowcss => 'border-bottom: 1px solid;', cellcss => 'border-left: 1px solid; border-right: 1px solid; ',], ["".PGML::Format('[[count[4]]]')."",
colspan => '1',
halign  => 'c|',
rowcss  => 'border-bottom: 1px solid;',
cellcss => 'border-right: 1px solid; ',],
],
[ ["5",
midrule => '1',
rowcss  => 'border-bottom: 1px solid;',
cellcss => 'border-bottom: 1px solid;
border-left: 1px solid;
border-right: 1px solid; ',],
["".PGML::Format('[[count[5]]]')."", rowcss => 'border-bottom: 1px solid;', cellcss => 'border-top: 1px solid; border-right: 1px solid; ',], ], [ ["6", halign => '|r|', rowcss => 'border-bottom: 1px solid;', cellcss => 'border-left: 1px solid; border-right: 1px solid; ',], ["".PGML::Format('[[count[6]]]')."",
colspan => '1',
halign  => 'c|',
rowcss  => 'border-bottom: 1px solid;',
cellcss => 'border-right: 1px solid; ',],
],
[ ["7",
midrule => '1',
rowcss  => 'border-bottom: 1px solid;',
cellcss => 'border-bottom: 1px solid;
border-left: 1px solid;
border-right: 1px solid; ',],
["".PGML::Format('[[count[7]]]')."", rowcss => 'border-bottom: 1px solid;', cellcss => 'border-top: 1px solid; border-right: 1px solid; ',], ], [ ["8", halign => '|r|', rowcss => 'border-bottom: 1px solid;', cellcss => 'border-left: 1px solid; border-right: 1px solid; ',], ["".PGML::Format('[[count[8]]]')."",
colspan => '1',
halign  => 'c|',
rowcss  => 'border-bottom: 1px solid;',
cellcss => 'border-right: 1px solid; ',],
],
[ ["9",
midrule => '1',
rowcss  => 'border-bottom: 1px solid;',
cellcss => 'border-bottom: 1px solid;
border-left: 1px solid;
border-right: 1px solid; ',],
["".PGML::Format('[[count[9]]]')."", rowcss => 'border-bottom: 1px solid;', cellcss => 'border-top: 1px solid; border-right: 1px solid; ',], ], [ ["10", halign => '|r|', rowcss => 'border-bottom: 1px solid;', cellcss => 'border-left: 1px solid; border-right: 1px solid; ',], ["".PGML::Format('[[count[10]]]')."",
colspan => '1',
halign  => 'c|',
rowcss  => 'border-bottom: 1px solid;',
cellcss => 'border-right: 1px solid; ',],
],
[ ["11",
midrule => '1',
rowcss  => 'border-bottom: 1px solid;',
cellcss => 'border-bottom: 1px solid;
border-left: 1px solid;
border-right: 1px solid; ',],
["".PGML::Format('[[count[11]]]')."", rowcss => 'border-bottom: 1px solid;', cellcss => 'border-top: 1px solid; border-right: 1px solid; ',], ], [ ["12", halign => '|r|', rowcss => 'border-bottom: 1px solid;', cellcss => 'border-left: 1px solid; border-right: 1px solid; ',], ["".PGML::Format('[[count[12]]]')."",
colspan => '1',
halign  => 'c|',
rowcss  => 'border-bottom: 1px solid;',
cellcss => 'border-right: 1px solid; ',],
],
],
caption   => 'Hemoglobin levels (g/dL) for twelve American men at sea level:',
align     => '|r|c|l|',
columnscss => ['border-left: 0px solid; ',
'border-right: 0px solid; ',
' ',],
);@]*

Determine the mean hemoglobin level for this sample of men living at sea level in the USA:

The total sum of courses is [[$sum]] 2.1a) [\bar x] = [__________]{"$ans1"}

Determine the median hemoglobin level for this sample of men living at sea level in the USA:

2.1b)    [\tilde x]  = [__________]{"ans2"} 2.1c) Determine the first Quartile: 2.1d) Determine the third Quartile: END_PGML BEGIN_PGML_SOLUTION *SOLUTION* 10.) The tenth summation expression is just a sum of the respective products formed by sequential pairs of both data sets. We merely substitute for the given values in each term, and then sum accordingly. Edit solution soon... [\begin{aligned}&\\ \sum_{i = 1}^{n}x_i \cdot f_i&= x_1\cdot f_1 + x_2\cdot f_2 +x_3\cdot f_3 +x_4\cdot f_4 && \text{Expand for each term. }\\ \sum_{i = 1}^{n}x_i \cdot f_i&= [x1] \cdot [$f1] +[$x2] \cdot ([$f2]) +( [$x3]) \cdot [$f3] +[$x4] \cdot [$f4] && \text{Substituting for each term.}\\ \sum_{i = 1}^{n}x_i \cdot f_i&= [$xf1] ? [$xf2] ? [$xf3] +[$xf4] && \text{Evaluate each product.}\\ \sum_{i = 1}^{n}x_i \cdot f_i&= [$ans10]  && \text{Collect the terms.}
\end{aligned}]

END_PGML_SOLUTION

ENDDOCUMENT();

### Re: \tilde x is rendering as \bar x in PGML

by Alex Jordan -
Do you have the display mode set to images? Because if you do, then a stale image for that piece of math might be being used if there was an earlier stage in your editing where that piece of math was \bar x.