Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim
In directory sc8-pr-cvs1:/tmp/cvs-serv13231
Modified Files:
Matrix.mpl
Log Message:
Enhanced `aim/Matrix/EqnArray` so that if one gives a list of variables
as an additional argument, the equations are typeset so that those variables
line up in columns. Also, `aim/Matrix/Test` now gives correct entries a
green background (previously, just the incorrect entries were given a red
background). - GG
Index: Matrix.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Matrix.mpl,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Matrix.mpl 25 Aug 2003 21:47:19 -0000 1.3
--- Matrix.mpl 9 Jan 2004 08:19:20 -0000 1.4
***************
*** 19,25 ****
@`aim/Matrix/EqnArray`(u = v)@ returns a string of LaTeX code
for an @eqnarray*@ environment displaying the equation @u = v@.
",
proc(e::({vector,list} = {vector,list}))
! local u,v,i,s;
u := convert(lhs(e),list);
v := convert(rhs(e),list);
--- 19,34 ----
@`aim/Matrix/EqnArray`(u = v)@ returns a string of LaTeX code
for an @eqnarray*@ environment displaying the equation @u = v@.
+ A list of variables may optionally be given as second argument,
+ and if included @u = v@ is treated as a system of linear equations
+ and is typeset so that the variables with their coefficients line
+ up nicely in columns.
",
proc(e::({vector,list} = {vector,list}))
! local u,v,i,s,vars,c,j,leading;
! if nargs = 2 then
! vars := args[2];
! else
! vars := [];
! fi;
u := convert(lhs(e),list);
v := convert(rhs(e),list);
***************
*** 27,35 ****
ERROR(__("Unequal dimensions in vector equation"));
fi;
! s := "<latex>\\begin{eqnarray*}\n";
for i from 1 to nops(u) do
! s := s,`aim/LaTeX`(u[i])," &= ",`aim/LaTeX`(v[i])," \\\\\n";
od;
! s := cat(s,"\\end{eqnarray*}</latex>\n");
RETURN(s);
end
--- 36,68 ----
ERROR(__("Unequal dimensions in vector equation"));
fi;
! s := "<latex>\\[\\begin{array}{",
! `if`(evalb(nops(vars) > 1), cat("rc"$(nops(vars) - 1)), ""), "rcl}\n";
for i from 1 to nops(u) do
! if vars = [] then
! s := s, `aim/LaTeX`(u[i]);
! else
! leading := true;
! for j from 1 to nops(vars) do
! c := coeff(u[i], vars[j]);
! if j > 1 then
! if is(c = 0) or leading then
! s := s, " & & ";
! else
! s := s, `if`(evalb(c < 0), " &-& ", " &+& ");
! c := abs(c);
! fi;
! fi;
! s := s, NiceCoeff(c, vars[j], "lterm");
! if is(c <> 0) then
! leading := false;
! fi;
! od;
! if leading then
! s := s, " 0 ";
! fi;
! fi;
! s := s, " &=& ",`aim/LaTeX`(v[i])," \\\\\n";
od;
! s := cat(s,"\\end{array}\\]</latex>\n");
RETURN(s);
end
***************
*** 330,334 ****
feedback :=
! __("The entries shown in red are incorrect."),"\n<br/>\n";
if type([B],[matrix]) then
--- 363,367 ----
feedback :=
! __("Correct/incorrect entries are shown with green/red backgrounds, respectively."),"\n<br/>\n";
if type([B],[matrix]) then
***************
*** 342,346 ****
feedback := feedback,"<td bgcolor='red'>";
else
! feedback := feedback,"<td>";
fi;
feedback := feedback,"<latex>$$",`aim/LaTeX`(A0[i,j]),"$$</latex>\n </td>";
--- 375,379 ----
feedback := feedback,"<td bgcolor='red'>";
else
! feedback := feedback,"<td bgcolor='LightGreen'>";
fi;
feedback := feedback,"<latex>$$",`aim/LaTeX`(A0[i,j]),"$$</latex>\n </td>";
***************
*** 358,362 ****
feedback := feedback,"<td bgcolor='red'>";
else
! feedback := feedback,"<td>";
fi;
feedback := feedback,"<latex>$$",`aim/LaTeX`(A0[i]),"$$</latex></td></tr>\n";
--- 391,395 ----
feedback := feedback,"<td bgcolor='red'>";
else
! feedback := feedback,"<td bgcolor='LightGreen'>";
fi;
feedback := feedback,"<latex>$$",`aim/LaTeX`(A0[i]),"$$</latex></td></tr>\n";
|