Appendix. Some APL functions
Nelder-Mead simplex method
zSIMP;tev;s;f;fmm;mm;xmm;fo;fr;xr;xo;fe;xe;yes;fc;xc;sig
[1] © THE NELDER-MEAD SIMPLEX METHOD
[2] © The needful global variables
[3] © al,be,ga - the coefficients for the method
[4] © xinit - initial parameters' vector
[5] © k - parameters' step
[6] © maxtev - maximum number of iterations
[7] © indic - the indicator of the process end
[8] tev0
[9] fSUM2 sxinit®xinit+ð1 k×ð1 k°.=k
[10] loop:fmmf[mm(f)[1,2,½f]]
[11] xmms[mm;] ª foSUM2 xo(+/[1](mm[1]¬¼(½s)[1])s)÷n
[12] frSUM2 xrxo+al×xo-xmm[1;]
[13]
(frfmm[3])/loop1
[14] feSUM2 xe(ga×xr)+xo×1-ga ª yesfr<fmm[3]
[15] s[mm[1];](xe×yes)+xr×~yes ª f[mm[1]](fe×yes)+fr×~yes ª
test
[16] loop1:
(fr>fmm[2])/loop2
[17] s[mm[1];]xr ª f[mm[1]]fr ª
test
[18] loop2:yes~fr>fmm[1] ª xmm[1;](xmm[1;]×~yes)+xr×yes
[19] fmm[1](fmm[1]×~yes)+fr×yes
[20] fcSUM2 xc(be×xmm[1;])+(1-be)×xo
[21]
(fcfmm[1])/loop3
[22] fSUM2 s(xmm[3;]÷2)+ð1 s ª
test
[23] loop3:s[mm[1];]xc ª f[mm[1]]fc
[24] test:sig(+/f*2)-((+/f)*2)÷n+1
[25]
((indic<sig÷n+1)^tev<maxtev)/loop
[26] zxmm[3;]
zSUM2 par;x;pr
© CALCULATION OF THE ERROR SUM OF SQUARES
[1] © The needful global variables
[2] © model - the character string of the conjectured model
[3] © t - the independent variable
[4] © y - the dependent variable
[5] z¼0 ª tevtev+pr(½par)[1]*¯1+½½par
[6] ,('ªx',ð1par),ð1(pr,½'ªzz,',model)½'ªzz,',model
[7] z+/(y-ð1(pr,½t)½z)*2
Runge-Kutta method
RUNGE iter;s;k1;k2;k3;k4;f1;f2;f3;f4
[1] © RUNGE-KUTTA METHOD
[2] © iter - the number of points being calculated
[3] © The needful global variables:
[4] © t - the initial value of independent variable
[5] © y - the initial values of dependent variable and its derivatives
[6] © (1 row matrix)
[7] © h - the step of calculation
[8] © model - the character string of model
[9] f1model TRANSFORM't''(t[½t])'
[10] f1f1 TRANSFORM'y''(y[(½y)[1];])'
[11] f2model TRANSFORM't''(t[½t]+h÷2)'
[12] f3f2 TRANSFORM'y''(y[(½y)[1];]+k2÷2)'
[13] f2f2 TRANSFORM'y''(y[(½y)[1];]+k1÷2)'
[14] f4model TRANSFORM't''(t[½t]+h)'
[15] f4f4 TRANSFORM'y''(y[(½y)[1];]+k3)'
[16] s'tt,(t[½t]+h)yy®(1÷6)×((h×f4)+(2×k3h×f3)+(2×k2h×f2)+k1h×f1)'
[17] © add calculated values to t and y
[18] (iter×5)½'s ª '
zmod TRANSFORM vect;mod1
[1] © SEARCH AND REPLACE CHARACTERS WITHIN A STRING
[2] © mod - a character string to be transformed
[3] © vect - boxed array
[4] © vect[1] - character to be changed
[5] © vest[2] - the sequence of characters to replace vect[1] with
[6] mod1<ð¯1 mod
[7] mod1[(mod1ð0 vect[1])/¼½mod1]vect[2]
[8] z(' '¬,>mod1)/,>mod1
Neural Network
NET indic;nt;w;alfa;nodesout;nodesin;res
[1] © NEURAL NETWORK CALCULATION
[2] © indic - the indicator of the process end
[3] © The needful global variables:
[4] © ns - the number of the input layer's nodes
[5] © na1 - the number of the first internal layer's nodes
[6] © na2 - the number of the second internal layer's nodes
[7] © nw - the number of the output layer's nodes
[8] © input - inputs' matrix
[9] © output - outputs' matrix
[10] ntns+na1+na2+nw
[11] resmin1e75
[12] w(nt,nt)½0
[13] alfant½0.5
[14] nodesoutnodesin((½,input)[1],nt)½0
[15] loop:alfaADAPA alfa
[16] wADAPW w
[17] nodesinnodesout+.×w
[18] nodesin[;¼ns]nodesin[;¼ns]+®input
[19] nodesoutnodesin÷alfa+ð1 nodesin
[20] res+/(+/(-output)+ð1³nodesout[;ns+na1+na2+¼nw])*2
[21]
(((res>resmin),(res<indic))/loop,end),next
[22] next:resminres ª
loop
[23] © store the results
[24] end:resww ª resalfaalfa ª resoutnodesout[;ns+na1+na2+¼nw]
zADAPA z
[1] © alfa ADAPTATION
[2] . . .
zADAPW z
[1] © WEIGHTS ADAPTATION
[2] . . .