WeBWorK Main Forum

MathObject formatting PG 2.6/2.7

MathObject formatting PG 2.6/2.7

by Gavin LaRose -
Number of replies: 1
Hi all,

Another WeBWorK installation updating question. I have a problem that defines a vector valued function with a series of Computes and then displays it to the user, a la the following.

  $v1 = Compute("($twoc1)*t+$c2");
  $v2 = Compute("-$c1*e^(-t)") );
  $v3 = Compute("-($c1c2)*sin($c2*t)");
  $vel = Vector( $v1, $v2, $v3 );
  Context()->texStrings;
  BEGIN_TEXT
  The velocity of a particle is given by
  \( {\bf v}(t) = \{ $vel->ijk \} \)
  ...

When I'm running PG on branch release/2.6 it displays as I expect, as in the top figure in the attached (below). When I'm running PG on branch master (updated today) I get the display in the bottom. In both cases I'm running WeBWorK on master, updated today.

Is this a feature change, a bug, or a subtle (or, as many of them, not so subtle) error on my part?

Thanks,
Gavin

Attachment eqnformat.png
In reply to Gavin LaRose

Re: MathObject formatting PG 2.6/2.7

by Gavin LaRose -
Hi all,

As a follow-up, I've isolated the problem to the rendering of the ijk format of the vector. A stripped down version of the problem that I'm using is appended. In this, both ijk formatted vectors display as in the lower figure above (as an experiment, I also moved the definition of $vijk above the Context()->texStrings call, to no effect); the standard formatted vector is as expected; and the components of the vector all display correctly.

Thoughts welcome. Thanks,
Gavin

DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
);
TEXT(beginproblem());
$showPartialCorrectAnswers = 1;

$c1 = non_zero_random(-5,5,1); $c2 = non_zero_random(3,7,1); $c3 = non_zero_random(-3,3,1);
$c1c2 = $c1*$c2;  $twoc1 = 2*$c1; $c2m1 = $c2 - 1;  $nc1c2 = -1*$c1c2;
Context('Vector')->variables->add('t'=>'Real');
@vel = ( Compute("($twoc1)*t+$c2"), Compute("-$c1*e^(-t)"), Compute("-($c1c2)*sin($c2*t)") );
$vel = Vector( @vel );
$acc = $vel->D;

Context()->texStrings;
$vijk = $vel->ijk;
BEGIN_TEXT
The velocity of a particle is given by \( {\bf v}(t) = \{ $vel->ijk \} \). Find
the acceleration \( {\bf a}(t) \): \{ ans_rule(45) \}
$PAR
\(v_1 = $vel[0] \)$BR \(v_2 = $vel[1] \)$BR
\(v_3 = $vel[2] \)$BR \(v = $vel \)$BR
\(v = $vijk\)
END_TEXT
ANS( $acc->cmp() );
ENDDOCUMENT();