aboutsummaryrefslogtreecommitdiff
path: root/math/bevington/fderiv.f
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /math/bevington/fderiv.f
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'math/bevington/fderiv.f')
-rw-r--r--math/bevington/fderiv.f39
1 files changed, 39 insertions, 0 deletions
diff --git a/math/bevington/fderiv.f b/math/bevington/fderiv.f
new file mode 100644
index 00000000..720953cb
--- /dev/null
+++ b/math/bevington/fderiv.f
@@ -0,0 +1,39 @@
+c subroutine fderiv.f (non-analytical)
+c
+c source
+c Bevington, page 242.
+c
+c purpose
+c evaluate derivatives of function for least-squares search
+c for arbitrary function given by functn
+c
+c usage
+c call fderiv (x, i, a, deltaa, nterms, deriv)
+c
+c description of parameters
+c x - array of data points for independent variable
+c i - index of data points
+c a - array of parameters
+c deltaa - array of parameter increments
+c nterms - number of parameters
+c deriv - derivatives of function
+c
+c subroutines and function subprograms required
+c functn (x, i, a)
+c evaluates the fitting function for the ith term
+c
+ subroutine fderiv (x,i,a,deltaa,nterms,deriv)
+ dimension x(1),a(1),deltaa(1),deriv(1)
+ real FUNCTN
+ external FUNCTN
+
+11 do 18 j=1,nterms
+ aj=a(j)
+ delta=deltaa(j)
+ a(j)=aj+delta
+ yfit=functn(x,i,a)
+ a(j)=aj-delta
+ deriv(j)=(yfit-functn(x,i,a))/(2.*delta)
+18 a(j)=aj
+ return
+ end