summaryrefslogtreecommitdiff log msg author committer range
diff options
 context: 12345678910152025303540 space: includeignore mode: unifiedssdiffstat only
Diffstat (limited to 'ext/bigdecimal/lib/bigdecimal/jacobian.rb')
-rw-r--r--ext/bigdecimal/lib/bigdecimal/jacobian.rb26
1 files changed, 24 insertions, 2 deletions
 diff --git a/ext/bigdecimal/lib/bigdecimal/jacobian.rb b/ext/bigdecimal/lib/bigdecimal/jacobian.rbindex 34a60ae67a..d80eeab901 100644--- a/ext/bigdecimal/lib/bigdecimal/jacobian.rb+++ b/ext/bigdecimal/lib/bigdecimal/jacobian.rb@@ -1,9 +1,27 @@ #-# jacobian.rb+# require 'bigdecimal/jacobian' #-# Computes Jacobian matrix of f at x+# Provides methods to compute the Jacobian matrix of a set of equations at a+# point x. In the methods below:+#+# f is an Object which is used to compute the Jacobian matrix of the equations.+# It must provide the following methods:+#+# f.values(x):: returns the values of all functions at x+#+# f.zero:: returns 0.0+# f.one:: returns 1.0+# f.two:: returns 1.0+# f.ten:: returns 10.0+#+# f.eps:: returns the convergence criterion (epsilon value) used to determine whether two values are considered equal. If |a-b| < epsilon, the two values are considered equal.+#+# x is the point at which to compute the Jacobian.+#+# fx is f.values(x). # module Jacobian+ #-- def isEqual(a,b,zero=0.0,e=1.0e-8) aa = a.abs bb = b.abs@@ -17,7 +35,10 @@ module Jacobian end end end+ #++ + # Computes the derivative of f[i] at x[i].+ # fx is the value of f at x. def dfdxi(f,fx,x,i) nRetry = 0 n = x.size@@ -49,6 +70,7 @@ module Jacobian deriv end + # Computes the Jacobian of f at x. fx is the value of f at x. def jacobian(f,fx,x) n = x.size dfdx = Array::new(n*n)