integ-init.lua - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/integ-init.lua
blob: 891eafe2250a90ef29fc49bac97d995b1b501e91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

local template = require 'template'
local check = require 'check'
function num.quad_prepare(options)
 local known_methods = {qng= true, qag= true}
 local method = options.method or 'qag'
 local order = options.order or 21
 local limit = options.limit or 64
 if not known_methods[method] then
 error('the method ' .. method .. ' is unknown')
 end
 check.integer(limit)
 if limit < 8 then limit = 8 end
 
 local q = template.load(method, {limit= limit, order= order})
 return q
end
local q_default
function num.integ(f, a, b, epsabs, epsrel)
 epsabs = epsabs or 1e-8
 epsrel = epsrel or 1e-8
 check.number(a)
 check.number(b)
 
 if not q_default then
 q_default = template.load('qag', {limit= 64, order= 21})
 end
 local result = q_default (f, a, b, epsabs, epsrel)
 return result
end
generated by cgit v1.2.3 (git 2.39.1) at 2025年10月02日 01:50:55 +0000

AltStyle によって変換されたページ (->オリジナル) /