Appendix. Some APL functions

Nelder-Mead simplex method

       z„SIMP;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]    tev„0
[9]    f„SUM2 s„xinit®xinit+ð1 k×ð1 k°.=k
[10]  loop:fmm„f[mm„(”f)[1,2,½f]]
[11]   xmm„s[mm;] ª fo„SUM2 xo„(+/[1](mm[1]¬¼(½s)[1])šs)÷n
[12]   fr„SUM2 xr„xo+al×xo-xmm[1;]
[13]   …(fr‰fmm[3])/loop1
[14]   fe„SUM2 xe„(ga×xr)+xo×1-ga ª yes„fr<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]   fc„SUM2 xc„(be×xmm[1;])+(1-be)×xo
[21]   …(fcˆfmm[1])/loop3
[22]   f„SUM2 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]   z„xmm[3;]

      z„SUM2  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  ª  tev„tev+pr„(½par)[1]*¯1+½½par
[6]   –,('ªx„',ð1•par),ð1(pr,½'ªz„z,',model)½'ªz„z,',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]   f1„model TRANSFORMœ't'œ'(t[½t])'
[10]  f1„f1 TRANSFORMœ'y'œ'(y[(½y)[1];])'
[11]  f2„model TRANSFORMœ't'œ'(t[½t]+h÷2)'
[12]  f3„f2 TRANSFORMœ'y'œ'(y[(½y)[1];]+k2÷2)'
[13]  f2„f2 TRANSFORMœ'y'œ'(y[(½y)[1];]+k1÷2)'
[14]  f4„model TRANSFORMœ't'œ'(t[½t]+h)'
[15]  f4„f4 TRANSFORMœ'y'œ'(y[(½y)[1];]+k3)'
[16]  s„'t„t,(t[½t]+h)y„y®(1÷6)×((h×–f4)+(2×k3„h×–f3)+(2×k2„h×–f2)+k1„h×–f1)'
[17] © add calculated values to t and y
[18]  –(iter×5)½'–s ª '

      z„mod 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]  nt„ns+na1+na2+nw
[11]  resmin„1e75
[12]  w„(nt,nt)½0
[13]  alfa„nt½0.5
[14]  nodesout„nodesin„((½,input)[1],nt)½0
[15] loop:alfa„ADAPA alfa
[16]  w„ADAPW w
[17]  nodesin„nodesout+.×w
[18]  nodesin[;¼ns]„nodesin[;¼ns]+®input
[19]  nodesout„nodesin÷alfa+ð1 nodesin
[20]  res„+/(+/(-output)+ð1³nodesout[;ns+na1+na2+¼nw])*2
[21]  …(((res>resmin),(res<indic))/loop,end),next
[22] next:resmin„res ª …loop
[23] © store the results
[24] end:resw„w ª resalfa„alfa ª resout„nodesout[;ns+na1+na2+¼nw]

     z„ADAPA z
[1] © alfa ADAPTATION
[2]    .  .  .

     z„ADAPW z
[1] © WEIGHTS ADAPTATION
[2]    .  .  .