Dear Hans, Here is the file in my desktop. The reason I didn’t define “sgn” in the function “uppertri” is that it is inherited from the call of “determinant’. However, I put “sgn=1” so that the function “uppertri” works independently.
I checked the function “uppertri” and found that it worked fine. Here is a sample file. \environment MatrixLuacode \starttext \getbuffer[luaMatrix] \startformula\startalign \startluacode local mat = {{0, 2, 4, -4, 1},{0, 0, 2, 3 , 4}, {2, 2, -6, 2, 4 }, {2,0 , -6, 9, 7},{2, 2, -6, 2, 4 },{2, 2, -6, 2, 4 }} -- local mat = {{1,2,3},{3,4,5},{3,4,5},{3,4,5},{3,4,5}} context.NC("\\text{Given Matrix}\\quad\\Rightarrow\\quad") context.NC() matrixOP.write(mat) context.NR() context.NC() context("\\text{Upper Triangular}\\quad\\Rightarrow\\quad") mat = matrixOP.upperTri(mat) context.NC() matrixOP.write(mat) context.NR() \stopluacode \stopalign\stopformula \stoptext Sometimes, I got “-0” as an entry of matrix after calculation but I couldn’t resolve it(I asked about it to this list before). Thank you. Best regards, Dalyoung
MatrixLuacode.tex
Description: Binary data
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________