Skip to content

Commit 39a6f05

Browse files
committed
Merge branch 'master' of github.com:openwebwork/webwork-open-problem-library
2 parents 6a9cc84 + 37b07d2 commit 39a6f05

File tree

261 files changed

+21629
-401
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

261 files changed

+21629
-401
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# DESCRIPTION
2+
# WeBWorK problem written by Stefan Lukits
3+
# <slukits(at)bcit(dot)ca>
4+
# DBsubject(Statistics)
5+
# DBchapter(Confidence intervals)
6+
# DBsection(Variance)
7+
# Date(2018/03/29)
8+
# Institution(British Columbia Institute of Technology)
9+
# Author(Stefan Lukits)
10+
# KEYWORDS('Statistics inference')
11+
# ISBN 0256126518 page 220
12+
# supported by the BCcampus Open Homework Systems Project Grant
13+
14+
DOCUMENT();
15+
loadMacros(
16+
"PGstandard.pl",
17+
"MathObjects.pl",
18+
);
19+
20+
Context("Numeric");
21+
22+
$i1=random(0,3,1);
23+
@n=("37","54","41","62");
24+
@squ=("79","125","93","95");
25+
@cnf=("80","90","95","99");
26+
@chisqL=(29.051,34.764,24.433,35.534);
27+
@chisqR=(51.805,67.505,59.342,91.952);
28+
$ppercent = sprintf("%.1f", $ppercent);
29+
$a1=sprintf("%.2f", (($n[$i1]-1)*$squ[$i1])/$chisqR[$i1]);
30+
$a2=sprintf("%.2f", (($n[$i1]-1)*$squ[$i1])/$chisqL[$i1]);
31+
32+
TEXT(beginproblem());
33+
Context()->texStrings;
34+
BEGIN_TEXT
35+
A sensitive measuring device should not have a large variance in the errors of measurements it makes. A random sample of $n[$i1] measurement errors gives \(s^{2}=$squ[$i1]\). Give a $cnf[$i1]% confidence interval for the variance of measurement errors, assuming that the measurement errors are approximately normally distributed.
36+
$PAR
37+
The lower bound is approximately \{ ans_rule(7) \} (round to two digits after the decimal point).$BR
38+
The upper bound is approximately \{ ans_rule(7) \} (round to two digits after the decimal point).
39+
END_TEXT
40+
Context()->normalStrings;
41+
ANS(num_cmp((($n[$i1]-1)*$squ[$i1])/$chisqR[$i1],
42+
tolType => 'absolute',
43+
tolerance => .02,
44+
));
45+
ANS(num_cmp((($n[$i1]-1)*$squ[$i1])/$chisqL[$i1],
46+
tolType => 'absolute',
47+
tolerance => .02,
48+
));
49+
Context()->texStrings;
50+
SOLUTION(EV3(<<'END_SOLUTION'));
51+
$PAR SOLUTION $PAR
52+
The lower bound is $a1.$BR
53+
The upper bound is $a2.
54+
END_SOLUTION
55+
Context()->normalStrings;
56+
ENDDOCUMENT();
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
##TYPE('word problem')
2+
##DESCRIPTION
3+
## Calculate the tension in a string with a spider resting on it.
4+
##ENDDESCRIPTION
5+
6+
## DBsubject(Dynamics)
7+
## DBchapter(Planar kinetics of rigid bodies)
8+
## DBsection(Equations of motion)
9+
## Date(08/18/2021)
10+
## Institution(British Columbia Institute of Technology)
11+
## Author(Stefan Lukits)
12+
## TitleText1('College Physics')
13+
## AuthorText1('Paul Peter Urone and Roger Hinrichs')
14+
## Section1('4.5')
15+
## Problem1('19')
16+
## KEYWORDS('tension','force')
17+
# supported by the BCcampus Open Homework Systems Project Grant
18+
19+
DOCUMENT();
20+
21+
loadMacros(
22+
"PGstandard.pl",
23+
"MathObjects.pl",
24+
"PGcourse.pl",
25+
"parserPopUp.pl"
26+
);
27+
28+
TEXT(beginproblem());
29+
30+
# Defining the variables of the question:
31+
Context("Numeric");
32+
33+
$spidermass = random(6,7,8,9);
34+
$sagangle = random(7.18,9.59,14.48,5.74);
35+
$ratioindex = random(0,1,2,3);
36+
@ratio = ("4:1","3:1","2:1","5:1");
37+
$tensionA = 9.81*$spidermass*10**(-5);
38+
39+
$tensionyB = 9.81*$spidermass*10**(-5)/2;
40+
$tensionB = $tensionyB/sin($sagangle*pi/180);
41+
42+
$mc = PopUp(["2:1","3:1","4:1","5:1"],$ratio[$ratioindex]);
43+
44+
$rationum = $tensionB/$tensionA;
45+
$rationum = sprintf("%.0f", $rationum);
46+
47+
# Displaying the main body of the questions text
48+
Context()->texStrings;
49+
BEGIN_TEXT
50+
51+
${BBOLD}(a)${EBOLD} Calculate the tension in a vertical strand of spider
52+
web if a spider of mass \($spidermass \cdot 10^{-5} kg\) hangs motionless on it. \{ ans_rule(10) \}
53+
$BR
54+
$BR
55+
${BBOLD}(b)${EBOLD} Calculate the tension in a horizontal
56+
strand of spider web if the same spider sits motionless
57+
in the middle of it (answer with the tension on one side of the string the spider sits on).
58+
The strand sags at an angle of \($sagangle^\circ\) below the
59+
horizontal. \{ ans_rule(10) \}
60+
$BR
61+
$BR
62+
${BBOLD}(c)${EBOLD} Compare this with the tension in the vertical
63+
strand (find their horizontal:vertical ratio). \{ $mc->menu() \}
64+
65+
END_TEXT
66+
67+
# Setting the correct answers
68+
Context()->normalStrings;
69+
70+
ANS ( num_cmp($tensionA));
71+
ANS ( num_cmp($tensionB));
72+
ANS ( $mc->cmp());
73+
74+
# Displaying the solution to the problem
75+
Context()->texStrings;
76+
BEGIN_SOLUTION
77+
${PAR}SOLUTION:${PAR}
78+
79+
The tension in part ${BBOLD}(a)${EBOLD} is equal to the gravitational force on the spider as the spider is motionless and therefore the tension must be equal and opposite such that there is no net force. The gravitational force is \(F_g = g \cdot m = -9.81 \cdot $spidermass \cdot 10^{-5} = $tensionA N\); this is equal and opposite to the tension we are looking for.
80+
$BR
81+
$BR
82+
The tension in part ${BBOLD}(b)${EBOLD} is found by first finding the vertical contribution of each end of the string's tension and then performing trig to calculate the total tension on each end. First we know that each end contributes half of the tension needed to counter the gravitational force, so each vertical component of tension is \(\frac{9.81 \cdot $spidermass \cdot 10^{-5}}{2} = $tensionyB{}N\). We know that the total tension times the sine of the sag angle is the vertical component so we divide the vertical component of the tension by sine to find the total tension: \(\frac{$tensionyB}{\sin($sagangle)} = $tensionB N\)
83+
$BR
84+
$BR
85+
Part ${BBOLD}(c)${EBOLD} involves dividing the answer from ${BBOLD}(b)${EBOLD} by the answer from part ${BBOLD}(a)${EBOLD} and deducing the ratio: \(\frac{$tensionB}{$tensionA} = $rationum\). Thus we conclude the ratio is $ratio[$ratioindex].
86+
87+
END_SOLUTION
88+
89+
Context()->normalStrings;
90+
ENDDOCUMENT();
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# DESCRIPTION
2+
# WeBWorK problem written by Stefan Lukits
3+
# <slukits(at)bcit(dot)ca>
4+
# DBsubject(Linear algebra)
5+
# DBchapter(Inner products)
6+
# DBsection(Projection and distance)
7+
# Date(2021/11/15)
8+
# Institution(British Columbia Institute of Technology)
9+
# Author(Stefan Lukits)
10+
# supported by the BCcampus Open Homework Systems Project Grant
11+
12+
DOCUMENT(); # This should be the first executable line in the problem.
13+
14+
loadMacros(
15+
"PGstandard.pl",
16+
"RserveClient.pl",
17+
"MathObjects.pl"
18+
);
19+
20+
TEXT(beginproblem());
21+
$showPartialCorrectAnswers = 1;
22+
23+
### Random number generator seed based on student's login. No need to change.
24+
Context("Numeric");
25+
# warn("Student name: $studentName, login: $studentLogin, id: $studentID");
26+
my $hash = crypt($studentLogin, 'a1');
27+
# warn("crypt: $hash");
28+
@nums = (0..9,'a'..'z','A'..'Z');
29+
my %nums = map { $nums[$_] => $_ } 0..$#nums;
30+
my $seed = 0;
31+
$seed = $seed * 39 + $nums{$_} foreach split(//, substr($hash, -5, 5));
32+
# warn("seed: " . $seed);
33+
34+
### Call R server
35+
rserve_eval("set.seed($seed)");
36+
37+
$dozf=random(0.01,0.99,0.01);
38+
$xxmx=random(201,499,1);
39+
$refp=$xxmx+$dozf;
40+
@a2=("A","B","C","D");
41+
$i1=random(0,3,1);
42+
$d1=random(2,12,0.01);
43+
$dt=random(21,29,0.01);
44+
$d2=-$dt;
45+
$d3=random(11,19,0.01);
46+
$d4=random(11,19,0.01);
47+
$ab=$d2-$d1;
48+
$ac=$d3-$d1;
49+
$ad=$d4-$d1;
50+
$bc=$d3-$d2;
51+
$bd=$d4-$d2;
52+
$cd=$d4-$d3;
53+
@error=rserve_eval('
54+
a1<-round(rnorm(10,mean=0,sd=0.2),2);
55+
');
56+
$d1we=$d1+$error[0];
57+
$d2we=$d2+$error[1];
58+
$d3we=$d3+$error[2];
59+
$d4we=$d4+$error[3];
60+
$abwe=$ab+$error[4];
61+
$acwe=$ac+$error[5];
62+
$adwe=$ad+$error[6];
63+
$bcwe=$bc+$error[7];
64+
$bdwe=$bd+$error[8];
65+
$cdwe=$cd+$error[9];
66+
Context("Matrix");
67+
$A=Matrix([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[-1,1,0,0],[-1,0,1,0],[-1,0,0,1],[0,-1,1,0],[0,-1,0,1],[0,0,-1,1]]);
68+
$At=$A->transpose;
69+
$Yt=Matrix([[$d1we,$d2we,$d3we,$d4we,$abwe,$acwe,$adwe,$bcwe,$bdwe,$cdwe]]);
70+
$Y=$Yt->transpose;
71+
$AtA=$At*$A;
72+
$AtAi=$AtA->inverse;
73+
$V=$AtAi*$At*$Y;
74+
$d1u=$V->element(1,1);
75+
$d2u=$V->element(2,1);
76+
$d3u=$V->element(3,1);
77+
$d4u=$V->element(4,1);
78+
if ($i1==0)
79+
{
80+
$answer=$refp+$d1u;
81+
}
82+
elsif ($i1==1)
83+
{
84+
$answer=$refp+$d2u;
85+
}
86+
elsif ($i1==2)
87+
{
88+
$answer=$refp+$d3u;
89+
}
90+
else
91+
{
92+
$answer=$refp+$d4u;
93+
}
94+
95+
BEGIN_TEXT
96+
You are trying to find the elevation of four points \(A,B,C,D\) near a reference point \(P\). The elevation of the reference point \(P\) is known to be \($refp\) metres above sea level. You measure the elevation differences between each pair of points according to the following table (for example, according to your measurement, the elevation of \(A\) is \($d1we\) metres higher than the elevation of \(P\)).
97+
$BR
98+
\[
99+
\begin{array}{lrrrr}
100+
\mbox{from/to} & A & B & C & D \\
101+
P & $d1we & $d2we & $d3we & $d4we \\
102+
A & & $abwe & $acwe & $adwe \\
103+
B & & & $bcwe & $bdwe \\
104+
C & & & & $cdwe \\
105+
\end{array}
106+
\]
107+
$BR
108+
What is the least-squares adjusted elevation in metres above sea level of point \($a2[$i1]\)?
109+
$PAR
110+
Answer: \{ans_rule(12)\}
111+
112+
END_TEXT
113+
114+
ANS(num_cmp($answer,
115+
tolType => 'absolute',
116+
tolerance => .01,
117+
));
118+
119+
COMMENT('This problem requires WeBWorK integration of R statistical software. See the WeBWorK wiki for documentation.');
120+
121+
ENDDOCUMENT(); # This should be the last executable line in the problem.
122+
$BR
123+
\[
124+
\begin{array}{lrrrr}
125+
\mbox{from/to} & A & B & C & D \\
126+
P & $d1 & $d2 & $d3 & $d4 \\
127+
A & & $ab & $ac & $ad \\
128+
B & & & $bc & $bd \\
129+
C & & & & $cd \\
130+
\end{array}
131+
\]
132+
The correct answer is \($answer\).

0 commit comments

Comments
 (0)