Parent Directory
|
Revision Log
Log message
1 ## DESCRIPTION 2 ## Find 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('9/18/2009') 12 ## Author('Ted Shifrin') 13 ## Institution('University of Georgia') 14 15 16 DOCUMENT(); # This should be the first executable line in the problem. 17 18 loadMacros("PG.pl", 19 "PGbasicmacros.pl", 20 "PGchoicemacros.pl", 21 "PGmatrixmacros.pl", 22 "PGanswermacros.pl", 23 "PGauxiliaryFunctions.pl", 24 "Parser.pl", 25 "weightedGrader.pl" 26 ); 27 28 install_weighted_grader(); 29 30 TEXT( beginproblem() ); 31 $showPartialCorrectAnswers = 1; 32 33 Context("Vector")->variables->are(x=>'Real',y=>'Real'); 34 35 $a = random(1, 5, 1 ); 36 $b = non_zero_random( -3, 3, 1 ); 37 $c = non_zero_random( -3, 3, 1 ); 38 39 $v = non_zero_random(-4,4); 40 $w = non_zero_random(-4,4); 41 42 $f = Formula("$a x^2+ $b x y^2 + $c y^3")->reduce; 43 $arg = '\left(\begin{array}{c} x\\y \end{array}\right)'; 44 45 $d = non_zero_random( -3, 3, 1 ); 46 do{$e = non_zero_random( -3, 3, 1 ); 47 $fx = $f -> D('x') -> eval(x=>$d, y=>$e); 48 $fy = $f -> D('y') -> eval(x=>$d, y=>$e);} until $fx*$d+$fy*$e!=0; 49 $P = ColumnVector($d, $e); 50 $V = ColumnVector($v, $w); 51 52 $fval = $f -> eval(x=>$d, y=>$e); 53 $dirder = $fx*$v + $fy*$w; 54 $RHS = $fx*$d+$fy*$e; 55 $ans1 = $fx/$RHS; 56 $ans2 = $fy/$RHS; 57 58 Context() -> texStrings; 59 60 BEGIN_TEXT 61 Suppose \( f $arg = $f \), \( \mathbf{a} = $P \), and \(\mathbf{v} = $V\). 62 63 $PAR 64 Compute the gradient of f at \(\mathbf{a}\). $BR 65 66 \{mbox('\(\nabla f(\mathbf{a}) = \)', answer_matrix(2,1,15) ) \} 67 68 $BR 69 70 $PAR 71 Compute the directional derivative of \(f\) at \(\mathbf{a}\) in the direction \(\mathbf{v}\). $BR 72 \{ ans_rule(30) \} 73 $BR 74 75 $PAR 76 For what value \( c\) does \(\mathbf{a}\) lie on the level curve \(f $arg = c\) ? 77 $BR 78 \{ mbox ('\( c = \)', ans_rule(15) ) \} 79 80 $PAR 81 For that value of \( c\), give the equation of the the tangent line to the level curve \(f $arg = c\) at the point \(\mathbf{a}\). Note that the right-hand side is already filled in for you. 82 83 $BR 84 \{mbox( ans_rule(15), '\(x + \)', ans_rule(15), '\( y = 1 \).') \} 85 $PAR 86 87 END_TEXT 88 89 WEIGHTED_ANS($fx->cmp,15, 90 $fy->cmp,15, 91 $dirder->cmp,20, 92 $fval->cmp,10, 93 $ans1->cmp,20, 94 $ans2->cmp,20); 95 96 97 98 ENDDOCUMENT(); # This should be the last executable line in the problem. 99 100 # display_matrix([[NAMED_ANS_RULE('opt1',15)], 101 # [NAMED_ANS_RULE('opt2',15)]]) ) \} 102 # \{ NAMED_ANS_RULE('opt3',30)\} $BR 103 # \{ mbox ('\( c = \)', NAMED_ANS_RULE('opt4',15) ) \} 104 # \{mbox(NAMED_ANS_RULE('opt5',15), '\(x + \)', NAMED_ANS_RULE('opt6',15), '\( # y = 1 \)', '.') \} 105 106 NAMED_WEIGHTED_ANS('opt1',$fx->cmp,15); 107 NAMED_WEIGHTED_ANS('opt2',$fy->cmp,15); 108 NAMED_WEIGHTED_ANS('opt3',$dirder->cmp,20); 109 NAMED_WEIGHTED_ANS('opt4',$fval->cmp,10); 110 NAMED_WEIGHTED_ANS('opt5',$ans1->cmp,20); 111 NAMED_WEIGHTED_ANS('opt6',$ans2->cmp,20); 112 113 114 115
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |