module GSL::Sum

Overview

This module implements Series Acceleration using the Levin u-transform

Usage example:

n = 20
exact = Math::PI * Math::PI / 6.0
v = (1..n).map { |i| 1 / (i*i) }
result, err_est = GSL::Sum.accelerate(v)
puts "exact value is #{exact}"
puts "sum of #{n} members is #{v.sum} (error #{v.sum - exact})"
puts "accelerated sum #{result} (estimated error #{err_est}, actual error #{result - exact})"

Defined in:

gsl/maths/analysis/acceleration.cr

Class Method Summary

Class Method Detail

def self.accelerate(values) #

Extrapolate sum of values with precise error estimate.

Returns sum and error estimate

Precise error estimation is a O(N^2) process.

values could be a Slice(Float64) or Array(Float64)


[View source]
def self.accelerate_trunc(values) #

Extrapolate sum of values without precise error estimate.

Returns sum and error estimate

values could be a Slice(Float64) or Array(Float64)


[View source]