summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/luanumint/luanumint.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/latex/luanumint/luanumint.sty')
-rw-r--r--macros/luatex/latex/luanumint/luanumint.sty22
1 files changed, 11 insertions, 11 deletions
diff --git a/macros/luatex/latex/luanumint/luanumint.sty b/macros/luatex/latex/luanumint/luanumint.sty
index 95eccf22bb..e873d15da7 100644
--- a/macros/luatex/latex/luanumint/luanumint.sty
+++ b/macros/luatex/latex/luanumint/luanumint.sty
@@ -1,9 +1,9 @@
% The luanumint package
-% version 1.1
+% version 1.2
% 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{luanumint}[1.1]
+\ProvidesPackage{luanumint}[1.2]
\RequirePackage{luacode,breqn,xkeyval}
\begin{luacode*}
function checksign(x)
@@ -13,12 +13,12 @@ function checksign(x)
return ''
end
end
-
+-- Function to round off numbers.
function mathrnd(num, numDecimalPlaces)
local mult = 10^(numDecimalPlaces or 0)
return math.floor(num * mult + 0.5) / mult
end
-
+-- Function for the midpoint rule.
function luamidpt (f,a,b,n,trun)
local trun = trun or 4
local h = (b - a) / n
@@ -30,7 +30,7 @@ function luamidpt (f,a,b,n,trun)
end
return mathrnd(sum*h,trun)
end
-
+-- Function for the midpoint rule with steps.
function luamidptSteps (f,a,b,n,nm,trun)
local trun = trun or 4
local nm = nm or "f"
@@ -54,7 +54,7 @@ function luamidptSteps (f,a,b,n,nm,trun)
end
return str .."\\right] \\\\ = "..otstr.."\\right) \\\\ = "..mathrnd(sum*mathrnd(h,trun),trun)
end
-
+-- Function for the Trapezoidal rule.
function luatrapz (f,a,b,n,trun)
local trun = trun or 4
local h = (b - a) / n
@@ -70,7 +70,7 @@ function luatrapz (f,a,b,n,trun)
end
return mathrnd(sum*h/2,trun)
end
-
+-- Function for the Trapezoidal rule with Steps.
function luatrapzsteps (f,a,b,n,nm,trun)
local trun = trun or 4
local nm = nm or "f"
@@ -99,7 +99,7 @@ function luatrapzsteps (f,a,b,n,nm,trun)
end
return str .."\\right] \\\\ = "..otstr.."\\right) \\\\ = "..mathrnd(sum*mathrnd(h/2,trun),trun)
end
-
+-- Function for the Simpsons one-third rule.
function luasimpsononethird (f,a,b,n,trun)
if (not(n % 2 == 0)) then error("Number of subintervals should be even.") end
local trun = trun or 4
@@ -120,7 +120,7 @@ function luasimpsononethird (f,a,b,n,trun)
end
return mathrnd(sum*h/3,trun)
end
-
+-- Function for the Simpsons one-third rule with steps.
function luasimpsononethirdsteps (f,a,b,n,nm,trun)
if (not(n % 2 == 0)) then error("Number of subintervals should be even.") end
local trun = trun or 4
@@ -155,7 +155,7 @@ function luasimpsononethirdsteps (f,a,b,n,nm,trun)
end
return str .."\\right] \\\\ = "..otstr.."\\right) \\\\ = "..mathrnd(sum*mathrnd(h/3,trun),trun)
end
-
+-- Function for the Simpsons three-eighth rule.
function luasimpsonthreight (f,a,b,n,trun)
if (not(n % 3 == 0)) then error("No. of sub-intervals should be multiple of 3.") end
local trun = trun or 4
@@ -177,7 +177,7 @@ function luasimpsonthreight (f,a,b,n,trun)
end
return mathrnd(sum*3*h/8,trun)
end
-
+-- Function for the Simpsons three-eighth rule with steps.
function luasimpsonthreightsteps (f,a,b,n,nm,trun)
if (not(n % 3 == 0)) then error("No. of sub-intervals should be multip.") end
local trun = trun or 4