Algorithm 282: Derivatives of ex/x, cos (x)/x, AND sin (x)/x

1 k T~) = h (~ fo + fl + " " + f2k-, + ~ f~), and T~) 4~T22 ~-T2~ 4m__1 then the Romberg quadrature rule gives f ro n f(t) dt = T(~) = ~ wif(ti), 0 i=0 where n = 2q, m = (p-2)/2, and k = q-m. The left and right endpoints must be in t[0] and t[n] respectively. The abscissas are returned in t[0] to t[nn] and the corresponding weights in w[0] to w[n]. If p = 2 the Romberg rule is the same as the repeated trape-zoid rule, and if p = 4, the same as the repeated Simpson rule. For n ~ 128 and p ~ 16, the numerical integration of powers (less than p) of x on the interval [0, 1] gave answers correct to one round off error in an ll-digit mantissa. New aspects in numerical quadrature. Proc. of Symp. in Appl. for i := n-1 step-1 until 1 do beginw[i] := c[i] :=0; t[i] := i X h + t[O] end; m := (p-2)/2; c[0] := 1.0; s :=m4:= 1; c[n] := 0; if m > ln(n)/ln(2) then m := ln(n)/ln(2); for j := 1 step 1 until m do beginm4 := 4Xm4; ml := m4-1; for i := j step-1 until 1 do c[i] := (m4 X c[i]-c[i-1])/ml; c[0] := c[0] X (m4/ml); end; for i := 0 step 1 until m do begin ci := c[i] X s; forj := 0 step s until n do w[j] := w[j]+ci; s:=2Xs end; w{O] := win] := 0.5×w[O]; forj := 0 step 1 until n do w[j] := w[j] X h; end rombergrule ALGORITHM 282 DERIVATIVES OF e~/x, cos (x)/x, AND sin (x)/x* comment This procedure generates the derivatives d~(x) = dx~ \ x/ (n = O, 1, 2, ..., nmax) using the recurrence relation d,(x) = (e ~-nd~_,(x))/x (n = 1, 2, 3, ...). The results are stored in the array d. If x = 0, there is an error exit to a global label called alarm; begin integer n; real e; if x = 0 then go to alarm; e := exp(x); d[0] := e/x; for n := 1 step 1 untilnnmax do d[n] := (e-nXd[n-1])/x array c; comment This procedure obtains the derivatives d" /cos x\ nmax) c~(x) = ~x~ ~-~-) (n = 0,1,2, "", from the recurrence relation c~(x) = (r,(x)-nc~a(x))/x (n = 1, 2, The …