## DBsubject('Calculus') ## DBchapter('Differentiation in Several Variables') ## DBsection('The Gradient and Directional Derivatives') ## KEYWORDS('calculus') ## TitleText1('Calculus: Early Transcendentals') ## EditionText1('2') ## AuthorText1('Rogawski') ## Section1('14.5') ## Problem1('23') ## Author('JustAsk - Vladimir Finkelshtein') ## Institution('W.H.Freeman') DOCUMENT(); loadMacros("PG.pl","PGbasicmacros.pl","PGanswermacros.pl"); loadMacros("Parser.pl"); loadMacros("freemanMacros.pl"); loadMacros("PGauxiliaryFunctions.pl"); loadMacros("PGgraphmacros.pl"); loadMacros("PGchoicemacros.pl"); TEXT(beginproblem()); Context()->texStrings; $x=non_zero_random(-2,2,1); $y=non_zero_random(-2,2,1); $xpow=random(1,3,1); $ypow=random(1,3,1); $i=non_zero_random(-3,3,1); $j=non_zero_random(-3,3,1); $i1=$i; $j1=$j; if($i1==1){$i1=''}; if($i1==-1){$i1='-'}; if($j1==1){$j1=''}; if($j1==-1){$j1='-'}; $norm2=($i)**2+($j)**2; $context = Context(); $context->variables->add(y=>'Real'); $f=Formula("x^($xpow)*y^($ypow)")->reduce(); $fx=Formula("$xpow*x^($xpow-1)*y^($ypow)")->reduce(); $fy=Formula("$ypow*x^($xpow)*y^($ypow-1)")->reduce(); $gradx=$fx->eval(x=>$x, y=>$y); $grady=$fy->eval(x=>$x, y=>$y); $dernum=$gradx*$i+$grady*$j; $der=($gradx*$i+$grady*$j)/sqrt($norm2); BEGIN_TEXT \{ textbook_ref_exact("Rogawski ET 2e", "14.5","23") \} $PAR Calculate the directional derivative of \(f(x,y)=$f\) in the direction of \(\mathbf{v}=$i1 \mathbf{i}+$j1\mathbf{j}\) at the point \(P=($x,$y)\). Remember to normalize the direction vector. $PAR \( D_uf($x,$y)=\) \{ans_rule()\} $BR END_TEXT Context()->normalStrings; ANS($der->cmp); Context()->texStrings; SOLUTION(EV3(<<'END_SOLUTION')); $PAR $SOL $BR We normalize \(\mathbf{v}\) to obtain a unit vector \(\mathbf{u}\) in the direction of \(\mathbf{v}\): \[\mathbf{u}=\frac{\mathbf{v}}{||\mathbf{v}||}=\frac{1}{\sqrt{$norm2}}($i1\mathbf{i} +$j1 \mathbf{j})\] We compute the gradient of \(f(x,y)=$f\) at the point \(P\): \[\nabla f=\left< \frac{\partial{f}}{\partial{x}}, \frac{\partial{f}}{\partial{y}} \right>=\left<$fx,$fy\right>\quad \Rightarrow \quad \nabla f($x,$y)=\left<$gradx, $grady\right>\] The directional derivative in the direction \(\mathbf{v}\) is thus \[D_uf($x,$y)=\nabla f($x,$y) \cdot \mathbf{u}=\left< $gradx, $grady \right> \cdot \frac{1}{\sqrt{$norm2}} \left<$i, $j\right>=\frac{$dernum}{\sqrt{$norm2}}\approx $der\] $BR END_SOLUTION ENDDOCUMENT();