Changeset 3190 for production/sydney_2006/find_max.py
- Timestamp:
- Jun 21, 2006, 9:31:57 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
production/sydney_2006/find_max.py
r2878 r3190 35 35 c = 0 36 36 direction = 'negative' 37 xstar = x0 38 print 'start of loop', deriv 37 39 while c < 100000 and deriv > 0: 38 40 deriv = dfuncdx(x,0.83) 39 if deriv < 0: xstar = x 41 if deriv < 0: 42 xstar = x 43 print 'hello', deriv, xstar/lam0, c 40 44 if direction == 'positive': x += step 41 45 if direction == 'negative': x -= step 42 46 c += 1 47 43 48 44 49 print 'location of maximum of surface elevation function: xstar = %f' % (xstar/lam0) 45 50 const = 1.0 #a3D = ? #sydney = 86? and kappad=1 46 51 47 x = arange(-20,25,0.001)48 y = arange(-10,10,0.1)49 X,Y = meshgrid(x,y)52 #x = arange(-20,25,0.001) 53 #y = arange(-10,10,0.1) 54 #X,Y = meshgrid(x,y) 50 55 51 test = 0.052 for xi in x:53 testi = func(xi,0.0,0.83)54 if direction == 'positive':55 if testi > test:56 test = testi57 xstar = xi58 else:59 if testi < test:60 test = testi61 xstar = xi56 #test = 0.0 57 #for xi in x: 58 # testi = func(xi,0.0,0.83) 59 # if direction == 'positive': 60 # if testi > test: 61 # test = testi 62 # xstar = xi 63 # else: 64 # if testi < test: 65 # test = testi 66 # xstar = xi 62 67 63 print 'check: xstar = %f and eta(xstar) = %f' %(xstar/lam0, test)68 #print 'check: xstar = %f and eta(xstar) = %f' %(xstar/lam0, test)
Note: See TracChangeset
for help on using the changeset viewer.