[npl] / branches / UGA / 2.1.4.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# View of /branches/UGA/2.1.4.pg

Sat Jul 24 17:09:50 2010 UTC (2 years, 9 months ago) by ted shifrin
File size: 3482 byte(s)
Log message

    1 ## DESCRIPTION
2 ## Calculus
3 ## ENDDESCRIPTION
4
5 ## KEYWORDS('function', 'vector fields')
6
7
8 ## DBsubject('Calculus')
9 ## DBchapter('Partial Derivatives')
10 ## DBsection('Functions of Several Variables')
11 ## Date('')
12 ## Author('Ted Shifrin')
13 ## Institution('UGA')
14
15
16 DOCUMENT();
18            "PGbasicmacros.pl",
19            "PGchoicemacros.pl",
21            "PGauxiliaryFunctions.pl",
22            "MathObjects.pl",
23 );
24
25 ## Do NOT show partial correct answers
26 $showPartialCorrectAnswers = 0; 27 28 Context("Vector")->variables->are(x=>'Real', y=>'Real'); 29 30$F = '\mathbf F\left(\begin{array}{c} x\\y \end{array}\right)';
31
32 $F1 = ColumnVector("<x-1,y>"); 33$F2 = ColumnVector("<y,-x>");
34 $F3 = ColumnVector("<-y,-x>"); 35$F4 = ColumnVector("<x/(x^2+y^2),y/(x^2+y^2)>");
36 $F5 = ColumnVector("<x/sqrt(x^2+y^2),y/sqrt(x^2+y^2)>"); 37$F6 = ColumnVector("<-y/sqrt(x^2+y^2),x/sqrt(x^2+y^2)>");
38 $F7 = ColumnVector("<-y/(x^2+y^2),x/(x^2+y^2)>"); 39$F8 = ColumnVector("<x+y,2x+y>");
40 $F9 = ColumnVector("<x^2,y^2>"); 41$F10 = ColumnVector("<-y^2,x^2>");
42 $F11 = ColumnVector("<y/(x^2+y^2),-x/(x^2+y^2)>"); 43 44$vfmatch=new_match_list();
45 Context()->texStrings;
46 $vfmatch->qa ( 47 "$$F = F1$$", image("2.3.1.gif"), 48 "$$F = F2$$", image("2.3.2.gif"), 49 "$$F = F3$$", image("2.3.3.gif"), 50 "$$F = F4$$", image("2.3.4.gif"), 51 "$$F = F5$$", image("2.3.5.gif"), 52 "$$F = F6$$", image("2.3.6.gif"), 53 "$$F = F7$$", image("2.3.7.gif"), 54 "$$F = F8$$", image("2.3.8.gif"), 55 "$$F = F9$$", image("2.3.9.gif"), 56 "$$F = F10$$", image("2.3.10.gif"), 57 "$$F = F11$$",image("2.3.11.gif") 58 ); 59 60 #@graphs = ( 61 # "2.3.1.gif", 62 # "2.3.2.gif", 63 # "2.3.3.gif", 64 # "2.3.4.gif", 65 # "2.3.5.gif", 66 # "2.3.6.gif", 67 # "2.3.7.gif", 68 # "2.3.8.gif", 69 # "2.3.9.gif", 70 # "2.3.10.gif", 71 # "2.3.11.gif" 72 # ); 73 74 #@subset = NchooseK(11,11); 75 #@subset_of_questions = @questions[@subset]; 76 #@subset_of_graphs = @graphs[@subset]; 77 #@perm = NchooseK(11,11); 78 #@shuffled_subset_of_graphs = @subset_of_graphs[@perm]; 79 #@captions = @ALPHABET[0..10]; 80 81 82$numGraphs = 6;
83 $vfmatch->choose($numGraphs);
84 sub format_graphs {
85         my $self = shift; 86 my @in = @_; 87 my$out = "";
88         while(@in) {
89                 $out .= shift(@in). "#" ; 90 } 91$out;      # The output has to be a string in order to conform to the
92                    # specs for the match list object, but I've put some
93                    # markers in (#) so that
94                    # I can break the string up into a list for use
95                    # as an input into row.
96 }
97
98 # We need to change the output, since the normal
99 # output routine will put the pictures one above another.
100 $vfmatch->rf_print_a(~~&format_graphs); 101 102 BEGIN_TEXT 103 Match the vector fields with the sketches labeled A - F. You may 104 click on the thumbnail image to produce a larger image in a new window 105 (sometimes exactly on top of the old one).$BR
106 \{ $vfmatch -> print_q \} 107 END_TEXT 108 109 # Place the output into a table 110 TEXT( 111 begintable($numGraphs),
112  row( split("#",$vfmatch->print_a() ) ), 113 row(@ALPHABET[ 0..($numGraphs-1) ] ),
114 endtable(),
115 );
116
117 ANS(str_cmp( \$vfmatch ->ra_correct_ans()   ) ) ;
118
119
120
121
122 # TEXT( imageRow(~~@shuffled_subset_of_graphs,~~@captions) );
123 ENDDOCUMENT();
124
125
126