[rochester] / trunk / rochester_problib / instructiveProblems / NewProblems / ur_vc_12_10N.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# View of /trunk/rochester_problib/instructiveProblems/NewProblems/ur_vc_12_10N.pg

Thu Jul 19 16:22:01 2007 UTC (5 years, 10 months ago) by gage
File size: 2715 byte(s)
A collection of problems illustrating how to use MathObjects when
writing WeBWorK questions.


    1 ##DESCRIPTION
2 #
3 # File Created: 6/5/2000
5 # Problem Author: Joseph Neisendorfer
6 # WeBWorK Entry: David Etlinger
7 # Location: University of Rochester
8 #
9 # Compute divergence, curl, and div curl
10 # of a field
11 #
12 ##ENDDESCRIPTION
13
14 ##KEYWORDS('Vector','Divergence','Curl','Field')
15
16 DOCUMENT();        # This should be the first executable line in the problem.
17
19 "PGstandard.pl",
20 "PGcourse.pl",
21 "MathObjects.pl",
22 # "source.pl",
23 );
24
25 TEXT( beginproblem() );
26 $showPartialCorrectAnswers = 1; 27 28 ################### 29 # 30 # Setup 31 32 Context("Vector"); 33 34$a = random(1,10,1);
35 $b = random(1,10,1); 36$c = random(1,10,1);
37
38 $ans1 = 0; 39 40$ans7 = 0;
41
42 $VectI = Formula("$a*y*z");
43 $VectJ = Formula("$b*x*z");
44 $VectK = Formula("$c*x*y");
45
46 $VectEqu = Vector("$VectI*i + $VectJ*j +$VectK*k")->reduce;
47
48 $ans1 = ($VectI->D('x'))+($VectJ->D('y'))+($VectK->D('z'));
49   #   For multi-variable functions, one must specify the variable to
50   # differentiate with respect to as a parameter of the differentiation
51   # function, i.e. $Function->D('variable'); 52 53$ans2 = &Curl($VectI,$VectJ,$VectK); 54 # Using a subroutine defined below, the Curl is returned as a vector given 55 # the function -I,J,K components as parameters. 56 57$ans3 = Real("0");
58   #   Div of Curl of F = 0.
59
60 ###################
61 #
62 #  Text
63
64 Context()->texStrings;
65 BEGIN_TEXT
66 Let $$\mathbf{F} = VectEqu$$. Compute the following:
67   $PAR 68 A. div $$\mathbf{F} =$$ \{ans_rule(40)\} 69$PAR
70 B. curl $$\mathbf{F} =$$ \{ans_rule(80)\}
71   $PAR 72 C. div curl $$\mathbf{F} =$$ \{ans_rule(40)\} 73$PAR
74 Note: Your answers should be expressions of x, y and/or z; e.g. "3xy" or "z" or
75 "5".  To enter a vector as an answer use either the $$\mathbf{i} - 76 \mathbf{j}-\mathbf{k}$$ notation or $$<x_1,x_2,\ldots,x_n>$$ notation; e.g. for
77 $$5\mathbf{i} + 3\mathbf{j} + 4\mathbf{k}$$ enter either "5i + 3j + 4k" or
78 "<5,3,4>."  $PAR 79 END_TEXT 80 Context()->normalStrings; 81 82 ################### 83 # 84 # Answers 85 86 ANS($ans1->cmp);
87 ANS($ans2->cmp); 88 ANS($ans3->cmp);
89
90 ###################
91 #
92 #  Subroutine:
93 #
94 #    Given i-j-k components of a vector function with respect to x, y,
95 #  and z, and returns the curl of the function as a vector object.
96
97 sub Curl {
98
99   my ($FnI,$FnJ,$FnK) = @_; # Parameters passed into those three 100 # local variables. 101 102 my$FnIder = ($FnK->D('y')) - ($FnJ->D('z')),
103      $FnJder = ($FnI->D('z')) - ($FnK->D('x')), 104$FnKder = ($FnJ->D('x')) - ($FnI->D('y'));
105
106   Vector("$FnIder*i +$FnJder*j + \$FnKder*k");
107                              #   The curl of the vector function is returned
108                              # as a vector object.
109
110 };
111
112 ENDDOCUMENT();        # This should be the last executable line in the problem.