# [NTG-context] Simple command with variable number of arguments

Jeong Dal haksan at me.com
Sat May 24 08:55:21 CEST 2014

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()
matrixOP.write(mat)
context.NR()
context.NC()
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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: MatrixLuacode.tex
Type: application/octet-stream
Size: 3519 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20140524/92e4fd5d/attachment.obj>
-------------- next part --------------