Method: Num4InteLib#simpsonRule

Defined in:
lib/num4inte.rb

#simpsonRule(a, b, h, func) ⇒ double

ニュートン・コーツ法(2次:シンプソンの公式)

Examples:

h = 0.001
func = Proc.new{|x|
    next 4 / (1 + x * x)
}
y = Num4InteLib.simpsonRule(0, 1, h, func)

y = simpsonRule(a, b, h, func)

Parameters:

  • a (double)

    aの値

  • b (double)

    bの値

  • h (double)

    刻み幅

  • func (callback)

    xiに対する傾きを計算する関数

Returns:

  • (double)

    [a,b]の間の積分値



88
89
# File 'lib/num4inte.rb', line 88

attach_function :simpsonRule,
:CNum4Inte_rewton_simpsonRule, [:double, :double, :double, :f], :double