[npl] / trunk / NationalProblemLibrary / TCNJ / TCNJ_LengthOrthogonality / problem4.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

View of /trunk/NationalProblemLibrary/TCNJ/TCNJ_LengthOrthogonality/problem4.pg

Sat Jun 3 14:39:59 2006 UTC (7 years ago) by gage
File size: 2127 byte(s)
``` Cleaned problem code using convert-functions.pl
```

```    1 ## DESCRIPTION
2 ## Linear Algebra
3 ## ENDDESCRIPTION
4
5 ## KEYWORDS('inner product' 'orthogonal')
6 ## Tagged by tda2d
7
8 ## DBsubject('Linear Algebra')
9 ## DBchapter('Vector Spaces')
10 ## DBsection('Inner Product')
11 ## Date('')
12 ## Author('')
13 ## Institution('TCNJ')
14 ## TitleText1('')
15 ## EditionText1('')
16 ## AuthorText1('')
17 ## Section1('')
18 ## Problem1('')
19
20
21 DOCUMENT();        # This should be the first executable line in the problem.
23 "PG.pl",
24 "PGbasicmacros.pl",
25 "PGchoicemacros.pl",
27 "PGgraphmacros.pl",
28 "PGmatrixmacros.pl",
29 "PGnumericalmacros.pl",
30 "PGauxiliaryFunctions.pl",
31 "PGmorematrixmacros.pl",
32 "PGcomplexmacros.pl"
33 );
34
35 TEXT(beginproblem());
36 # Do not show which answers are incorrect.
38
39 \$n = non_zero_random(-4,4,2);
40 \$m = non_zero_random(-5,5,2);
41
42 \$w1 = random(-9,9,2);
43 \$w2 = random(-8,8,2);
44 \$w3 = random(-9,9,1);
45
46 \$x1 = - \$n;
47 \$x2 = - \$n;
48 \$x3 = \$n;
49
50 \$y1 = random(-8,8,2);
51 \$y2 = random(-9,9,2);
52 \$y3 = random(-9,9,1);
53
54 \$z1 = - \$m;
55 \$z2 = - \$m;
56 \$z3 = \$m;
57
58 # Make a new checkbox multiple choice
59 \$tf = new_pop_up_select_list();
60 \$tf->ra_pop_up_list(["?"=>"Select an Answer", "Yes" => "Yes", "No" => "No"]);
61 # \$cmc now "contains" the checkbox multiple choice object.
62
63 # Insert some  questions and matching answers in the q/a list
64
65 \$tf -> qa (
66
67 mbox( '\( v = \)', display_matrix([[\$w1], [\$w2], [\$w3]]) ),
68 "No",
69
70 mbox( '\( v = \)', display_matrix([[\$x1], [\$x2], [\$x3]]) ),
71 "Yes",
72
73 mbox( '\( v = \)', display_matrix([[\$y1], [\$y2], [\$y3]]) ),
74 "No",
75
76 mbox( '\( v = \)', display_matrix([[\$z1], [\$z2], [\$z3]]) ),
77 "Yes",
78 );
79
80 \$tf->choose(3);
81
82 # Insert some incorrect answers
83
84 # Print the text using \$mc->print_q for the questions and
85 # \$mc->print_a to print the answers.
86 BEGIN_TEXT
87
88 \{ mbox( 'Let \(W\) be the set of all vectors ', display_matrix([['x'], ['y'], ['x + y']]), 'with \(x\) and \(y\) real.'  ) \}
89 \$BR
90 Determine whether each of the following vectors is in \(W^{\perp}\).
91 \$BR
92 \$BR
93
94  \{ \$tf -> print_q \}
95
96 END_TEXT
97
98 # Enter the correct answers to be checked against the answers to the students.
99 ANS(str_cmp( \$tf->ra_correct_ans )   ) ;
100
101 ENDDOCUMENT();
```