Skip to content

Commit 3967133

Browse files
authored
Merge pull request #1168 from gajennings/main
Fix bug 4836, convert to PGML, add solution.
2 parents e261f13 + 5fd2301 commit 3967133

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

OpenProblemLibrary/Union/setMVvectors/an12_3_22.pg

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ DOCUMENT(); # This should be the first executable line in the problem.
2323

2424
loadMacros(
2525
"PGstandard.pl",
26-
"PGunion.pl",
2726
"MathObjects.pl",
27+
"PGML.pl",
2828
"parserVectorUtils.pl",
2929
"PGcourse.pl"
3030
);
@@ -46,39 +46,44 @@ $V = non_zero_vector3D();
4646
#
4747
# The projections
4848
#
49-
$U1 = (($U.$V)/($V.$V)) * $V;
50-
$U2 = $U - $U1;
49+
$U1 = Compute("(($U.$V)/($V.$V)) * $V");
50+
$U2 = Compute("$U - $U1");
51+
52+
$u = Overline('u');
53+
$v = Overline('v');
54+
$w = Overline('w');
55+
5156

5257
##############################################
5358
# Main text
5459

55-
$u = Overline('u');
56-
$v = Overline('v');
60+
BEGIN_PGML
61+
62+
Suppose [`[$u] = [$U]`] and [`[$v] = [$V]`]. Then:
63+
64+
a) The vector projection of [`[$u]`] along [`[$v]`] is [_]{$U1}{40}.
65+
66+
b) The vector projection of [`[$u]`] orthogonal to [`[$v]`] is [_]{$U2}{40}.
5767

58-
Context()->texStrings;
59-
BEGIN_TEXT
68+
END_PGML
6069

61-
Suppose \($u = $U\) and \($v = $V\). Then:
70+
BEGIN_PGML_SOLUTION
71+
a) Let [``[$w] = \frac{[$v]}{\sqrt{[$v] \cdot [$v]}}``] be the unit vector that points in the same direction as [`[$u]`]. The _scalar projection_ of [`[$u]`] along [`[$v]`] is the dot product [``[$u]\cdot [$w] = \frac{[$u]\cdot [$v]}{\sqrt{[$v] \cdot [$v]}}``]. The _vector projection_ of [`[$u]`] along [`[$v]`] is the scalar projection times times [`[$w]`]:
6272

63-
\{BeginList()\}
64-
$ITEM
65-
The projection of \($u\) along \($v\) is \{ans_rule(40)\}.
66-
$ITEMSEP
73+
[``\text{proj}_{[$v]}([$u]) = \frac{[$u]\cdot [$v]}{\sqrt{[$v] \cdot [$v]}}\frac{[$v]}{\sqrt{[$v] \cdot [$v]}}= \frac{[$u]\cdot [$v]}{[$v] \cdot [$v]}[$v] = \frac{[@ $U.$V @]}{ [@ $V.$V @] }[$V]``]
6774

68-
$ITEM
69-
The projection of \($u\) orthogonal to \($v\) is \{ans_rule(40)\}.
70-
\{EndList()\}
75+
b) [`[$v]`] is the sum of two perpendicular vectors, one points in the same direction as [`[$u]`], and the other points in a direction perpendicular to [`[$u]`]. The first is [``\text{proj}_{[$v]}([$u])``], the vector from part a). The other, [``[$v]-\text{proj}_{[$v]}([$u])``], is the vector that's requested in part b). So the answer for part b) is
7176

72-
END_TEXT
73-
Context()->normalStrings;
77+
[``[$U] - \frac{[@ $U.$V @]}{ [@ $V.$V @] }[$V]``]
78+
END_PGML_SOLUTION
7479

7580
##################################################
7681
# Answers
7782

78-
ANS($U1->cmp);
79-
ANS($U2->cmp);
83+
#ANS($U1->cmp);
84+
#ANS($U2->cmp);
8085

81-
$showPartialCorrectAnswers = 1;
86+
#$showPartialCorrectAnswers = 1;
8287

8388
##################################################
8489

0 commit comments

Comments
 (0)