1 c implicit real*8 (a-h,o-z)
3 real p(ndim+1,ndim),y(ndim+1),pb(ndim),pom(ndim),yb,ftol,temptr
29 call amebsa(p,y,ndim+1,ndim,ndim,pb,yb,ftol,f,iter,temptr)
40 f=0.5*((x(1)-1)**2+(x(2)+1)**2)+10*(1-cos(x(1)-1))*(1-cos(x(2)+1))
44 CcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccC
45 REAL FUNCTION ran1(idum)
46 INTEGER idum,IA,IM,IQ,IR,NTAB,NDIV
48 PARAMETER (IA=16807,IM=2147483647,AM=1./IM,IQ=127773,IR=2836,
49 * NTAB=32,NDIV=1+(IM-1)/NTAB,EPS=1.2e-7,RNMX=1.-EPS)
50 C "Minimal" random number generator of Park and Miller with Bays-Durham shuffle and
51 C added safeguards. Returns a uniform random deviate between 0.0 and 1.0 (exclusive of
52 C the endpoint values). Call with idum a negative integer to initialize; thereafter, do not
53 C alter idum between successive deviates in a sequence. RNMX should approximate the largest
54 C floating value that is less than 1. Recommended for seqences smaller than 100e6 (i.e. 5%
56 C (from Press etal, Numerical Recipes in Fortran 77)
57 CcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccC
58 INTEGER j,k,iv(NTAB),iy
60 DATA iv /NTAB*0/, iy /0/
61 if (idum.le.0.or.iy.eq.0) then ! initialize
62 idum=max(-idum,1) ! load the shuffle table (after 8 warmups)
65 idum=IA*(idum-k*IQ)-IR*k
66 if (idum.lt.0) idum=idum+IM
67 if (j.le.NTAB) iv(j)=idum
71 k=idum/IQ ! start here when not initializing
72 idum=IA*(idum-k*IQ)-IR*k
73 if (idum.lt.0) idum=idum+IM