Ruby 2.4参考手册
BigDecimal
Newton
包含的模块:LUSolve,Jacobian
newton.rb
用牛顿法求解非线性代数方程组f = 0。该程序不依赖于BigDecimal。
To call:
n = nlsolve(f,x)
where n is the number of iterations required,
x is the initial value vector
f is an Object which is used to compute the values of the equations to be solved.
它必须提供以下方法:
f.values(x)
返回x处所有函数的值
f.zero
returns 0.0
f.one
returns 1.0
f.two
returns 2.0
f.ten
returns 10.0
f.eps
返回用于确定两个值是否相等的收敛准则(ε值)。如果| ab | ε,这两个值被认为是相等的。
在退出时,x是解决方案向量。
公共实例方法
nlsolve(f,x) 显示源代码
BigDecimal相关

Ruby 是一种面向对象、命令式、函数式、动态的通用编程语言,是世界上最优美而巧妙的语言。
主页 | https://www.ruby-lang.org/ |
源码 | https://github.com/ruby/ruby |
版本 | 2.4 |
发布版本 | 2.4.1 |