diff options
Diffstat (limited to 'macros/luatex/latex/luagcd/luagcd.sty')
-rw-r--r-- | macros/luatex/latex/luagcd/luagcd.sty | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/macros/luatex/latex/luagcd/luagcd.sty b/macros/luatex/latex/luagcd/luagcd.sty index 12a5106ac3..6f2e64aaf1 100644 --- a/macros/luatex/latex/luagcd/luagcd.sty +++ b/macros/luatex/latex/luagcd/luagcd.sty @@ -1,12 +1,12 @@ % luagcd package -% version 1.0 +% version 1.1 % Licensed under LaTeX Project Public License v1.3c or later. The complete license text is available at http://www.latex-project.org/lppl.txt. % Authors: Chetan Shirore and Ajit Kumar -\ProvidesPackage{luagcd}[1.0] +\ProvidesPackage{luagcd}[1.1] \RequirePackage{luacode} \begin{luacode*} -function findgcd2(a,b) +function findgcd2(a,b) -- function to find gcd of 2 numbers. a = math.abs(a) b = math.abs(b) if b ~= 0 then @@ -16,7 +16,7 @@ function findgcd2(a,b) end end -function findgcd(...) +function findgcd(...) -- function to find gcd of 2 or more numbers. local tbl = table.pack(...) if #(tbl) > 2 then local rem = table.remove(tbl,1) @@ -27,7 +27,7 @@ function findgcd(...) end end -function inputcheck ( ... ) +function inputcheck ( ... ) -- validating input. local tbl = table.pack(...) for _, v in ipairs(tbl) do if type(v) ~= 'number' then @@ -39,14 +39,14 @@ function inputcheck ( ... ) end end end - -function luagcd(...) +- function to find gcd with input validatiion. +function luagcd(...) - inputcheck(...) return findgcd(...) end - -function stepbystepgcd(a,b,sep) +-- function to find gcd of 2 numbers with steps. +function stepbystepgcd(a,b,sep) if type(a) ~= 'number' or type(b) ~= 'number' then error('Only numbers are expected.') return @@ -100,7 +100,7 @@ end " is the last non-zero remainder and it is " ..t.. "." end end - +-- function to express gcd of 2 numbers as an integer linear combination. function lincombgcd (a,b) local val1,val2 = a,b if type(a) ~= 'number' or type(b) ~= 'number' then @@ -200,7 +200,7 @@ return ("The gcd of " .. val1 .." and " .. val2 .. " is " .. gcd .. " and the equation $" .. coeff1 .."x" .. op .. coeff2 .."y = " ..gcd .. "$ has a solution $(x,y) = (" .. e_3 .. "," .. f_3 ..")$.") end - +-- function to express gcd of 2 numbers as an integer linear combination with steps. function lincombgcdstepbystep (a,b) local val1,val2 = a,b if type(a) ~= 'number' or type(b) ~= 'number' then |