Here is the code. It makes use of the file matrix.lua available at the following link. https://github.com/davidm/lua-matrix/blob/master/lua/matrix.lua
The following code is to be run by matrix.lua
file in the same directory as that of tex
file. It is to be compiled with LuaLaTeX
engine.
\documentclass{article}
\begin{document}
\def\n{{{2,4,6},{8,10,12},{14,16,20}}}
\directlua{local matrix = require "matrix"
tex.sprint(matrix.latex(matrix.pow(\n,50)))}
\end{document}
When I run the command tex.sprint(matrix.latex(matrix.pow(\n,-50)))
. There is no problem. It runs fine and gives answer in scientific notation. So there is no problem with power -50. However with power 50, it gives absolutely wrong answer. This is definitely not issue with lua or matrix.lua. This is because when I run following commands in lua on local computer, I get correct answer.
local matrix = require "matrix"
n={{2,4,6},{8,10,12},{14,16,20}}
print(matrix.latex(matrix.pow(n,50)))
I also get correct answer when I run the code on overleaf. Basically answers on lua compiler on my local computer and overleaf compiler match. But answers produced by LuaLaTeX compiler on my computer are different from lua compiler on my computer or one that on overleaf. Where is the problem then?
Is there any issue with local computer? If so, how I get correct answer with power -50. I also get correct answer in lua compiler on my computer.
Why answers on overleaf compiler and my local computer are different for power 50. They match for power -50.
Does this issue have anything to do with capacities of local computer such as processor, operating system, 32 bits or 64 bits, ram etc.?
Note: There is some problem in the matrix.latex function of the file matrix.lua. It prints some unnecessary characters at the beginning of each row and in the last entry of the last row of the matrix. I already fixed it. But for this question, it can be neglected.