Greetings Webwork folks,
I would really like to be able to use the Mathematical symbols of "intersection", "Union", "overbar" etc... in a number of assignments on Probability.
I thought it was possible to do so if the Unicode characters were used.
Is it possible to use Unicode characters in Webwork's PopUp( ) menus?
My attempts at using the intersection symbol, ~~x{2229}, in Lines 102 and 111 below resulted in the following error statement.
Could the problem be that Version 10 can not handle Unicode characters?
Or do I have something wrong with my use of the Unicode characters?
The error statement is below.
Thanks for being willing to take a look at this.
Tim
Problem1
ERROR caught by Translator while processing problem file:Payer/S109/HW_4/income_longevity.pg
****************
ERRORS from evaluating PG file:
'require' trapped by operation mask at [PG]/lib/Value/AnswerChecker.pm line 780 Died within Value::String::cmp called at line 942 of [PG]/macros/PGML.pl from within PGML::Format::Answer called at line 839 of [PG]/macros/PGML.pl from within PGML::Format::string called at line 993 of [PG]/macros/PGML.pl from within PGML::Format::html::Indent called at line 830 of [PG]/macros/PGML.pl from within PGML::Format::string called at line 819 of [PG]/macros/PGML.pl from within PGML::Format::format called at line 1252 of [PG]/macros/PGML.pl from within PGML::Format called at line 1261 of [PG]/macros/PGML.pl from within PGML::Format2 called at line 142 of (eval 10617)
****************
------Input Read 1 ##DESCRIPTION 2 ## Applying the Rules of addition in probability given table data. 3 ## Emphasis on notation as well as numeric calculation. 4 ## Options for randomizing table data for algorithmic solutions. 5 ##ENDDESCRIPTION 6 7 8 ## DBsubject(Probability) 9 ## DBchapter(Random variables) 10 ## DBsection(Expectation) 11 ## Institution(HSU) 12 ## Beginning Statitstics(Tim Payer) 13 ## KEYWORDS('probability','rules of addition','notation') 14 15 DOCUMENT(); # This should be the first executable line in the problem. 16 17 loadMacros( 18 "PG.pl", 19 "PGbasicmacros.pl", 20 "PGchoicemacros.pl", 21 "PGanswermacros.pl", 22 "PGauxiliaryFunctions.pl", 23 "PGasu.pl", 24 "PGML.pl", 25 "parserPopUp.pl" 26 ); 27 28 TEXT(beginproblem()); 29 30 ## If you would rather not have algorithmic solutions with randomized table data: 31 ## You can "switch" off the randomization by un-commenting the declarations below 32 ## and then comment out the equivalent declarations that have randomization 33 ## in their declarations. 34 35 # $r[4] = 15; 36 # $u[4] = 150; 37 # $m[4] = 200; 38 # $l[0] = 205; 39 # $p[0] = 40; 40 41 Context("Numeric"); 42 Context()->flags->set( 43 tolerance => 0.0001, 44 tolType => "absolute", 45 ); 46 47 48 @x=( "89-95","86-88", "81-85", "77-80", "75-76"); 49 $r[4]= random(12, 18,1); 50 $r[3]= $r[4]*4 -1; 51 $r[2]= $r[4]*10 +3; 52 $r[1]= $r[4]*15 -5; 53 $r[0]= $r[4]*20 -14; 54 $rsum = $r[4]+$r[3]+$r[2]+$r[1]+$r[0]; 55 56 $u[4]= random(121, 131,1); 57 $u[3]= $u[4]*2 +25; 58 $u[2]= $u[4]*4 +3; 59 $u[1]= $u[4]*12 -15; 60 $u[0]= $u[4]*5 -14; 61 $usum = $u[4]+$u[3]+$u[2]+$u[1]+$u[0]; 62 63 $m[4]= random(201, 231,1); 64 $m[3]= $m[4]*4 -14; 65 $m[2]= $m[4]*10 +13; 66 $m[1]= $m[4]*6 -15; 67 $m[0]= $m[4]*3 +14; 68 $msum = $m[4]+$m[3]+$m[2]+$m[1]+$m[0]; 69 70 $l[0]= random(204, 224,1); 71 $l[1]= $l[0]*2 +52; 72 $l[2]= $l[0]*3 +33; 73 $l[3]= $l[0]*10 -5; 74 $l[4]= $l[0]*3 +14; 75 $lsum = $l[4]+$l[3]+$l[2]+$l[1]+$l[0]; 76 77 $p[0]= random(31, 43,1); 78 $p[1]= $p[0]*2 -17; 79 $p[2]= $p[0]*3 +3; 80 $p[3]= $p[0]*6 -15; 81 $p[4]= $p[0]*7 +24; 82 $psum = $p[4]+$p[3]+$p[2]+$p[1]+$p[0]; 83 84 $grand = $psum +$lsum +$msum +$usum +$rsum; 85 86 $col0sum = $r[0]+$u[0]+$m[0]+$l[0]+$p[0]; 87 $col1sum = $r[1]+$u[1]+$m[1]+$l[1]+$p[1]; 88 $col2sum = $r[2]+$u[2]+$m[2]+$l[2]+$p[2]; 89 $col3sum = $r[3]+$u[3]+$m[3]+$l[3]+$p[3]; 90 $col4sum = $r[4]+$u[4]+$m[4]+$l[4]+$p[4]; 91 92 $c1 = "P(B ~~x{2229} F)"; 93 $c2 = "P(B ~~x{222A} F)"; 94 $c3 = "P(B ~~x{2A2F} F)"; 95 96 $popup1 = PopUp( 97 ["probability notation", "P(86-88)", "P(A)", "P(B)", "P(C)", "P(D)","P(E)"], "P(B)"); 98 $ans1 =$col1sum/$grand; 99 100 $popup2 = PopUp( 101 #["probability notation", "P(B U F)", "P(BF)", $c1, "P(B + F)", $c3], $c1); 102 ["probability notation", "P(B U F)", "P(BF)", "P(B ~~x{2229} F)", "P(B + F)", "P(B x F)"], "P(B ~~x{2229} F)"); 103 $ans2 =$p[1]/$grand; 104 105 #Unicode errors due to non acceptance of: "P(B ~~x{2229} F)" 106 # Apparently the unicode wont work here? "~~x{2229}" wont render 107 # I will replace the "n" with intersection symbols once the proper code is found. 108 # And I still need to weight the responses with points. 109 110 $popup3 = PopUp( 111 ["probability notation", "P(R U L)", "P(RL)", "P(R ~~x{2229} L)", "P(R + L)", "P(R x L)"], "P(R ~~x{2229} L)"); 112 $ans3 =0; 113 114 $popup4 = PopUp( 115 ["probability notation", "P(R U L)", "P(RL)", "P(R n L)", "P(R + L)", "P(R x L)"], "P(R U L)"); 116 $ans4 =($rsum+$lsum)/$grand; 117 118 $popup5 = PopUp( 119 ["probability notation", "P(F n E)", "P(FE)", "P(F U E)", "P(F + E)", "P(F x E)"], "P(F U E)"); 120 $ans5 =Compute("($psum+$col4sum-$p[4])/$grand"); 121 122 123 124 BEGIN_TEXT 125 $BR 126 127 4.2) Recent census data supports the case that life expectancy is correlated with one's income bracket. Given a small town with a population of \($grand\) individuals has a distribution of life expectancy loosely based on the recent census, determine the following probabilities with fourth decimal accuracy. $BR 128 $PAR 129 $BLEFT 130 \{begintable(6)\} 131 \{row("Expectancy in years", @x, "Row Sum")\} 132 \{row("Rich", $r[0], $r[1],$r[2],$r[3],$r[4],$rsum)\} 133 \{row("Upper Middle Class", $u[0], $u[1],$u[2],$u[3],$u[4],$usum)\} 134 \{row(" Middle Class", $m[0], $m[1],$m[2],$m[3],$m[4],$msum)\} 135 \{row("Lower Middle Class", $l[0], $l[1],$l[2],$l[3],$l[4],$lsum)\} 136 \{row("Poor", $p[0], $p[1],$p[2],$p[3],$p[4],$psum)\} 137 \{row("Column Sum", $col0sum, $col1sum,$col2sum,$col3sum,$col4sum,$grand)\} 138 \{endtable()\} 139 $ELEFT 140 141 $PAR 142 Use the the following event variable declarations within probability notation to find the associated probabilities with fourth decimal accuracy. 143 $PAR 144 END_TEXT 145 146 BEGIN_PGML 147 148 [`A`] = Event that an individual of the town has a life expectancy of 89-95 years. 149 [`B`] = Event that an individual of the town has a life expectancy of 86-88 years. 150 [`C`] = Event that an individual of the town has a life expectancy of 81-85 years. 151 [`D`] = Event that an individual of the town has a life expectancy of 77-80 years. 152 [`E`] = Event that an individual of the town has a life expectancy of 75-79 years. 153 [`R`] = Event that an individual of the town is rich. 154 [`S`] = Event that an individual of the town is of the upper middle class. 155 [`M`] = Event that an individual of the town is of the middle class. 156 [`L`] = Event that an individual of the town is of the lower middle class. 157 [`F`] = Event that an individual of the town is poor. 158 159 160 4.2a) Find the probability of drawing an individual from the town that has a life expectancy of 86-88 years: 161 162 [_____]{$popup1} = [______]{$ans1} 163 164 4.2b) Find the probability of drawing an individual from the town that has a life expectancy of 86-88 years and is poor: 165 166 [_____]{$popup2} = [______]{$ans2} 167 168 4.2c) Find the probability of drawing an individual from the town that is rich and is of the lower middle class: 169 170 [_____]{$popup3} = [______]{$ans3} 171 172 4.2d) Find the probability of drawing an individual from the town that is rich or is of the lower middle class: 173 174 [_____]{$popup4} = [______]{$ans4} 175 176 4.2e) Find the probability of drawing an individual from the town that is either poor or has a life expectancy of 75-76 years or both: 177 178 [_____]{$popup5} = [______]{$ans5} 179 180 END_PGML 181 182 183 ENDDOCUMENT(); # This should be the last executable line in the problem. -----
'require' trapped by operation mask at [PG]/lib/Value/AnswerChecker.pm line 780 Died within Value::String::cmp called at line 942 of [PG]/macros/PGML.pl from within PGML::Format::Answer called at line 839 of [PG]/macros/PGML.pl from within PGML::Format::string called at line 993 of [PG]/macros/PGML.pl from within PGML::Format::html::Indent called at line 830 of [PG]/macros/PGML.pl from within PGML::Format::string called at line 819 of [PG]/macros/PGML.pl from within PGML::Format::format called at line 1252 of [PG]/macros/PGML.pl from within PGML::Format called at line 1261 of [PG]/macros/PGML.pl from within PGML::Format2 called at line 142 of (eval 10617)
****************
------Input Read 1 ##DESCRIPTION 2 ## Applying the Rules of addition in probability given table data. 3 ## Emphasis on notation as well as numeric calculation. 4 ## Options for randomizing table data for algorithmic solutions. 5 ##ENDDESCRIPTION 6 7 8 ## DBsubject(Probability) 9 ## DBchapter(Random variables) 10 ## DBsection(Expectation) 11 ## Institution(HSU) 12 ## Beginning Statitstics(Tim Payer) 13 ## KEYWORDS('probability','rules of addition','notation') 14 15 DOCUMENT(); # This should be the first executable line in the problem. 16 17 loadMacros( 18 "PG.pl", 19 "PGbasicmacros.pl", 20 "PGchoicemacros.pl", 21 "PGanswermacros.pl", 22 "PGauxiliaryFunctions.pl", 23 "PGasu.pl", 24 "PGML.pl", 25 "parserPopUp.pl" 26 ); 27 28 TEXT(beginproblem()); 29 30 ## If you would rather not have algorithmic solutions with randomized table data: 31 ## You can "switch" off the randomization by un-commenting the declarations below 32 ## and then comment out the equivalent declarations that have randomization 33 ## in their declarations. 34 35 # $r[4] = 15; 36 # $u[4] = 150; 37 # $m[4] = 200; 38 # $l[0] = 205; 39 # $p[0] = 40; 40 41 Context("Numeric"); 42 Context()->flags->set( 43 tolerance => 0.0001, 44 tolType => "absolute", 45 ); 46 47 48 @x=( "89-95","86-88", "81-85", "77-80", "75-76"); 49 $r[4]= random(12, 18,1); 50 $r[3]= $r[4]*4 -1; 51 $r[2]= $r[4]*10 +3; 52 $r[1]= $r[4]*15 -5; 53 $r[0]= $r[4]*20 -14; 54 $rsum = $r[4]+$r[3]+$r[2]+$r[1]+$r[0]; 55 56 $u[4]= random(121, 131,1); 57 $u[3]= $u[4]*2 +25; 58 $u[2]= $u[4]*4 +3; 59 $u[1]= $u[4]*12 -15; 60 $u[0]= $u[4]*5 -14; 61 $usum = $u[4]+$u[3]+$u[2]+$u[1]+$u[0]; 62 63 $m[4]= random(201, 231,1); 64 $m[3]= $m[4]*4 -14; 65 $m[2]= $m[4]*10 +13; 66 $m[1]= $m[4]*6 -15; 67 $m[0]= $m[4]*3 +14; 68 $msum = $m[4]+$m[3]+$m[2]+$m[1]+$m[0]; 69 70 $l[0]= random(204, 224,1); 71 $l[1]= $l[0]*2 +52; 72 $l[2]= $l[0]*3 +33; 73 $l[3]= $l[0]*10 -5; 74 $l[4]= $l[0]*3 +14; 75 $lsum = $l[4]+$l[3]+$l[2]+$l[1]+$l[0]; 76 77 $p[0]= random(31, 43,1); 78 $p[1]= $p[0]*2 -17; 79 $p[2]= $p[0]*3 +3; 80 $p[3]= $p[0]*6 -15; 81 $p[4]= $p[0]*7 +24; 82 $psum = $p[4]+$p[3]+$p[2]+$p[1]+$p[0]; 83 84 $grand = $psum +$lsum +$msum +$usum +$rsum; 85 86 $col0sum = $r[0]+$u[0]+$m[0]+$l[0]+$p[0]; 87 $col1sum = $r[1]+$u[1]+$m[1]+$l[1]+$p[1]; 88 $col2sum = $r[2]+$u[2]+$m[2]+$l[2]+$p[2]; 89 $col3sum = $r[3]+$u[3]+$m[3]+$l[3]+$p[3]; 90 $col4sum = $r[4]+$u[4]+$m[4]+$l[4]+$p[4]; 91 92 $c1 = "P(B ~~x{2229} F)"; 93 $c2 = "P(B ~~x{222A} F)"; 94 $c3 = "P(B ~~x{2A2F} F)"; 95 96 $popup1 = PopUp( 97 ["probability notation", "P(86-88)", "P(A)", "P(B)", "P(C)", "P(D)","P(E)"], "P(B)"); 98 $ans1 =$col1sum/$grand; 99 100 $popup2 = PopUp( 101 #["probability notation", "P(B U F)", "P(BF)", $c1, "P(B + F)", $c3], $c1); 102 ["probability notation", "P(B U F)", "P(BF)", "P(B ~~x{2229} F)", "P(B + F)", "P(B x F)"], "P(B ~~x{2229} F)"); 103 $ans2 =$p[1]/$grand; 104 105 #Unicode errors due to non acceptance of: "P(B ~~x{2229} F)" 106 # Apparently the unicode wont work here? "~~x{2229}" wont render 107 # I will replace the "n" with intersection symbols once the proper code is found. 108 # And I still need to weight the responses with points. 109 110 $popup3 = PopUp( 111 ["probability notation", "P(R U L)", "P(RL)", "P(R ~~x{2229} L)", "P(R + L)", "P(R x L)"], "P(R ~~x{2229} L)"); 112 $ans3 =0; 113 114 $popup4 = PopUp( 115 ["probability notation", "P(R U L)", "P(RL)", "P(R n L)", "P(R + L)", "P(R x L)"], "P(R U L)"); 116 $ans4 =($rsum+$lsum)/$grand; 117 118 $popup5 = PopUp( 119 ["probability notation", "P(F n E)", "P(FE)", "P(F U E)", "P(F + E)", "P(F x E)"], "P(F U E)"); 120 $ans5 =Compute("($psum+$col4sum-$p[4])/$grand"); 121 122 123 124 BEGIN_TEXT 125 $BR 126 127 4.2) Recent census data supports the case that life expectancy is correlated with one's income bracket. Given a small town with a population of \($grand\) individuals has a distribution of life expectancy loosely based on the recent census, determine the following probabilities with fourth decimal accuracy. $BR 128 $PAR 129 $BLEFT 130 \{begintable(6)\} 131 \{row("Expectancy in years", @x, "Row Sum")\} 132 \{row("Rich", $r[0], $r[1],$r[2],$r[3],$r[4],$rsum)\} 133 \{row("Upper Middle Class", $u[0], $u[1],$u[2],$u[3],$u[4],$usum)\} 134 \{row(" Middle Class", $m[0], $m[1],$m[2],$m[3],$m[4],$msum)\} 135 \{row("Lower Middle Class", $l[0], $l[1],$l[2],$l[3],$l[4],$lsum)\} 136 \{row("Poor", $p[0], $p[1],$p[2],$p[3],$p[4],$psum)\} 137 \{row("Column Sum", $col0sum, $col1sum,$col2sum,$col3sum,$col4sum,$grand)\} 138 \{endtable()\} 139 $ELEFT 140 141 $PAR 142 Use the the following event variable declarations within probability notation to find the associated probabilities with fourth decimal accuracy. 143 $PAR 144 END_TEXT 145 146 BEGIN_PGML 147 148 [`A`] = Event that an individual of the town has a life expectancy of 89-95 years. 149 [`B`] = Event that an individual of the town has a life expectancy of 86-88 years. 150 [`C`] = Event that an individual of the town has a life expectancy of 81-85 years. 151 [`D`] = Event that an individual of the town has a life expectancy of 77-80 years. 152 [`E`] = Event that an individual of the town has a life expectancy of 75-79 years. 153 [`R`] = Event that an individual of the town is rich. 154 [`S`] = Event that an individual of the town is of the upper middle class. 155 [`M`] = Event that an individual of the town is of the middle class. 156 [`L`] = Event that an individual of the town is of the lower middle class. 157 [`F`] = Event that an individual of the town is poor. 158 159 160 4.2a) Find the probability of drawing an individual from the town that has a life expectancy of 86-88 years: 161 162 [_____]{$popup1} = [______]{$ans1} 163 164 4.2b) Find the probability of drawing an individual from the town that has a life expectancy of 86-88 years and is poor: 165 166 [_____]{$popup2} = [______]{$ans2} 167 168 4.2c) Find the probability of drawing an individual from the town that is rich and is of the lower middle class: 169 170 [_____]{$popup3} = [______]{$ans3} 171 172 4.2d) Find the probability of drawing an individual from the town that is rich or is of the lower middle class: 173 174 [_____]{$popup4} = [______]{$ans4} 175 176 4.2e) Find the probability of drawing an individual from the town that is either poor or has a life expectancy of 75-76 years or both: 177 178 [_____]{$popup5} = [______]{$ans5} 179 180 END_PGML 181 182 183 ENDDOCUMENT(); # This should be the last executable line in the problem. -----