I have been customizing the ijk symbols to place a hat above them as shown in my code below. Although this works well with numerical vectors, I am having trouble getting my custom ijk sybols to show with gradient vectors involving x and y variables. Is this a bug?
See my code below. If I use the number form of $gr it displays my custom i and j, but with the variable vector $gr it does not. Instead all I see is the default script bold i and j.
Code:
Context("Vector2D");
Context()->variables->add( dx=>'Real', dy=>'Real' );
Context()->flags->set( ijk=>1 );$i = "\boldsymbol{\hat{\imath}}";
$j = MODES(
HTML_MathJax => "\boldsymbol{\hat{\jmath}}",
HTML => "\boldsymbol{\hat{\bf{\jmath}}}",
TeX => "\hat{j}");
$k = "\boldsymbol{\hat{k}}";Context()->constants->set(
i => {TeX => $i},
j => {TeX => $j},
k => {TeX => $k});$showPartialCorrectAnswers = 1;
$a = random(2,5,1);
$b = random(2,6,1);
$r = random(-1,1,2);$fx = Compute( "$a*x + $b*e^($r*y)" )->reduce();
$fy = Compute( "$b*x*e^($r*y)" )->reduce();$gr = Vector( $fx, $fy );
# $gr = Vector(3, 6);
$df = Compute( "$fx*dx + $fy*dy" );Context()->texStrings;
TEXT(beginproblem());$grad = MODES(
HTML_MathJax => "{\overset{\scriptstyle\rightharpoonup}{\nabla}}",
HTML => "{\overset{\rightharpoonup}{\vphantom{a}\smash{\nabla}}}",
TeX => "{\overset{\rightharpoonup}{\vphantom{a}\smash{\nabla}}}",
);BEGIN_TEXT
Find the total differential \( dz \) of the function \(f\)
given its gradient is:
\[ $grad f(x,y) = $gr. \]$PAR
\( dz = \) \{ ans_rule(35) \}END_TEXT
Context()->normalStrings;ANS($df->cmp() );
Context()->texStrings;
SOLUTION(EV3(<<'END_SOLUTION'));
$PAR SOLUTION $PARSince \($grad f(x,y) = f_x(x,y) $i + f_y(x,y) $j\) and
\( dz = f_x(x,y)\, dx + f_y(x,y)\,dy\), we have
\[ dz = $df. \]END_SOLUTION
Context()->normalStrings;
Thanks!
Paul