I have a circuit analysis question that I solve using a matrix inverse.

$M1 = Matrix([($R1+$R2),($R4+$R5)],[$W*$R2-1,1]);

$V1 = Vector($VS2,0);

$CurrentAns = $M1->inverse * $V1;

Then, I get the two answers:

$I1ans = Real($CurrentAns->element(1,1));

$I2ans = Real($CurrentAns->element(2,1));

and try to compare them with the student-entered answer:

ANS(num_cmp("$I1ans", units => 'A',reltol=>1));

ANS(num_cmp("$I2ans", units => 'A',reltol=>1));

However, if I "print" out the values I get:

-5.39287\times 10^{-8} | and 0.000647091 |

so the first **num_cmp** complains about the \.

The second **num_cmp** works fine (once I remove the **$I1ans** from the first **num_cmp**).

Any ideas what I'm doing wrong to get the LaTeX formatting for the first element?