[npl] / trunk / NationalProblemLibrary / Union / setMVderivatives / an14_6_1.pg Repository:
ViewVC logotype

View of /trunk/NationalProblemLibrary/Union/setMVderivatives/an14_6_1.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 882 - (download) (annotate)
Thu Jan 1 00:02:58 2009 UTC (4 years, 4 months ago) by dpvc
File size: 1928 byte(s)
Update to current Union versions (using MathObjects)

    1 ## DESCRIPTION
    2 ##   Calculate Gradient and Directional Derivative
    3 ## ENDDESCRIPTION
    4 
    5 ## KEYWORDS('Gradient', 'Directional', 'Derivative')
    6 ## Tagged by nhamblet
    7 
    8 ## DBsubject('Calculus')
    9 ## DBchapter('Partial Derivatives')
   10 ## DBsection('Directional Derivatives and the Gradient Vector')
   11 ## Date('8/23/07')
   12 ## Author('')
   13 ## Institution('Union College')
   14 ## TitleText1('Calculus')
   15 ## EditionText1('7')
   16 ## AuthorText1('Anton')
   17 ## Section1('14.6')
   18 ## Problem1('1')
   19 ## TitleText2('Calculus: Early Transcendentals')
   20 ## EditionText2('1')
   21 ## AuthorText2('Rogawski')
   22 ## Section2('14.5')
   23 ## Problem2('21 22 23 24 25 26 27 28 29 30')
   24 
   25 DOCUMENT();        # This should be the first executable line in the problem.
   26 
   27 loadMacros(
   28   "PGstandard.pl",
   29   "PGunion.pl",
   30   "MathObjects.pl",
   31   "parserVectorUtils.pl",
   32   "PGcourse.pl",
   33 );
   34 
   35 
   36 TEXT(beginproblem);
   37 
   38 ##############################################
   39 #  Setup
   40 
   41 Context("Vector")->flags->set(
   42   reduceConstants => 0,
   43   reduceConstantFunctions => 0,
   44 );
   45 
   46 #
   47 #  The function
   48 #
   49 $a = random(1,5,1);
   50 $b = random(2,5,1);
   51 
   52 $f = Formula("($a + $b x y)^(3/2)");
   53 
   54 #
   55 #  The point
   56 #
   57 ($x,$y) = (random(1,5,1),random(1,5,1));
   58 
   59 #
   60 #  The unit vector
   61 #
   62 $u = non_zero_vector2D(-2,2);
   63 $d = ($u.$u); $U = $u->TeX."/".Formula("sqrt($d)")->TeX;
   64 
   65 #
   66 #  The derivatives
   67 #
   68 $fx = $f->D('x');
   69 $fy = $f->D('y');
   70 
   71 $gradf = Vector($fx,$fy);
   72 $Duf = $gradf->eval(x=>$x,y=>$y) . unit($u);
   73 
   74 ##############################################
   75 #  Main text
   76 
   77 $uu = BoldMath('u');
   78 
   79 Context()->texStrings;
   80 BEGIN_TEXT
   81 
   82 Let \(f(x,y) = $f\).
   83 Then \($GRAD\!f\) = \{ans_rule(50)\}, and \(D_{$uu} f($x,$y)\) for
   84 \($uu = $U\) is \{ans_rule(30)\}.
   85 
   86 END_TEXT
   87 Context()->normalStrings;
   88 
   89 ##################################################
   90 #  Answers
   91 
   92 ANS(
   93   $gradf->cmp,
   94   $Duf->cmp,
   95 );
   96 
   97 $showPartialCorrectAnswers = 1;
   98 
   99 ##################################################
  100 
  101 ENDDOCUMENT();        # This should be the last executable line in the problem.

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9