DOCUMENT(); # This should be the first executable line in the problem. loadMacros( "PGstandard.pl", "PGunion.pl", "Parser.pl", "parserVectorUtils.pl", "PGcourse.pl" ); TEXT(beginproblem()); BEGIN_PROBLEM(); ############################################## # Setup Context("Vector"); # # The function # \$nx = random(2,5,1); \$ny = random(2,5,1); \$nz = random(2,5,1); \$m = \$nx*\$ny*\$nz; \$f = Formula("(x^\$nx y^\$ny z^\$nz)/(\$nx*\$ny*\$nz)"); # # The point # (\$x,\$y,\$z) = (non_zero_random(-3,3,1), non_zero_random(-3,3,1), non_zero_random(-3,3,1)); # # The vector # \$U = Vector((2*non_zero_random(-1,1,1), 2*non_zero_random(-1,1,1), non_zero_random(-1,1,1))[shuffle(3)]); # # The derivatives # \$fx = Formula("x^(\$nx-1) y^\$ny z^\$nz/(\$ny*\$nz)"); \$fy = Formula("x^\$nx y^(\$ny-1) z^\$nz/(\$nx*\$nz)"); \$fz = Formula("x^\$nx y^\$ny z^(\$nz-1)/(\$nx*\$ny)"); # # Directional derivative # \$gradf = Vector(\$fx,\$fy,\$fz); \$Duf = \$gradf->eval(x=>\$x,y=>\$y,z=>\$z) . unit(\$U); ############################################## # Main text \$u = BoldMath('u'); Context()->texStrings; BEGIN_TEXT Let \(f(x,y,z) = \$DISPLAY \$f\). \$PAR Then \(\$GRAD\!f\) = \{ans_rule(60)\}, and \(D_{\$u} f(\$x,\$y,\$z)\) in the direction of \(\$U\) is \{ans_rule(40)\}. END_TEXT Context()->normalStrings; ################################################## # Answers ANS(\$gradf->cmp); ANS(\$Duf->cmp); \$showPartialCorrectAnswers = 1; ################################################## END_PROBLEM(); ENDDOCUMENT(); # This should be the last executable line in the problem.