[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 248 - (download) (annotate)
Thu Jun 1 18:19:46 2006 UTC (6 years, 11 months ago) by jj
File size: 1334 byte(s)
New files.

    1 DOCUMENT();        # This should be the first executable line in the problem.
    2 
    3 loadMacros(
    4   "PGstandard.pl",
    5   "PGunion.pl",
    6   "Parser.pl",
    7   "parserVectorUtils.pl",
    8   "PGcourse.pl"
    9 );
   10 
   11 
   12 TEXT(beginproblem());
   13 BEGIN_PROBLEM();
   14 
   15 ##############################################
   16 #  Setup
   17 
   18 Context("Vector")->flags->set(
   19   reduceConstants => 0,
   20   reduceConstantFunctions => 0,
   21 );
   22 
   23 #
   24 #  The function
   25 #
   26 $a = random(1,5,1);
   27 $b = random(2,5,1);
   28 
   29 $f = Formula("($a + $b x y)^(3/2)");
   30 
   31 #
   32 #  The point
   33 #
   34 ($x,$y) = (random(1,5,1),random(1,5,1));
   35 
   36 #
   37 #  The unit vector
   38 #
   39 $u = non_zero_vector2D(-2,2);
   40 $d = ($u.$u); $U = $u->TeX."/".Formula("sqrt($d)")->TeX;
   41 
   42 #
   43 #  The derivatives
   44 #
   45 $fx = $f->D('x');
   46 $fy = $f->D('y');
   47 
   48 $gradf = Vector($fx,$fy);
   49 $Duf = $gradf->eval(x=>$x,y=>$y) . unit($u);
   50 
   51 ##############################################
   52 #  Main text
   53 
   54 $uu = BoldMath('u');
   55 
   56 Context()->texStrings;
   57 BEGIN_TEXT
   58 
   59 Let \(f(x,y) = $f\).
   60 Then \($GRAD\!f\) = \{ans_rule(50)\}, and \(D_{$uu} f($x,$y)\) for
   61 \($uu = $U\) is \{ans_rule(30)\}.
   62 
   63 END_TEXT
   64 Context()->normalStrings;
   65 
   66 ##################################################
   67 #  Answers
   68 
   69 ANS(
   70   $gradf->cmp,
   71   $Duf->cmp,
   72 );
   73 
   74 $showPartialCorrectAnswers = 1;
   75 
   76 ##################################################
   77 
   78 END_PROBLEM();
   79 ENDDOCUMENT();        # This should be the last executable line in the problem.

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9