首页 >

进退法求单峰区间

作者:fcode  日期:01-20
来源:Fcode研讨团队
program www_fcode_cn
  implicit none
   real a,b,c,d,e,f,g,h,i,j,T
  !!初始点[a,b];方向[e,f];初始步长T;单峰区间[g,j];首次跨步后[h,i];目标方程c(a,b),d(h,i)
  write(*,*) "variable: "
  read(*,*) a,b
  write(*,*) "Direction: "
  read(*,*) e,f
  write(*,*) "Step Size: "
  read(*,*) T
  g = 0.0
  j = g + T
  c = 3*(a**3) - 8*a + 9
  h = a + j * e
  i = b + j * f
  d = 3*(h**3) - 8*h + 9
  if (c < d) -="" 9="" a="" b="b" c="" d="c" do="" e="" f="" g="g" if="" j="j" t="-T" then="" > d ) exit
      j = g - T
      T = 2*T        
    end do  
  else if (c > d) then
    do while(c > d)    
      c = d        
      g = j - T    
      T = 2*T
      j = j + T    
      h = a + j*e
      i = b + j*f    
      d = h**2 + i**2 - 8*h - 12*i + 52        
    end do
  end if      
  write(*,*) "Unimodal Interval: ", g,j
end program www_fcode_cn
常规|工具|专业|读物|
代码|教学|算法|
首页 >
FortranCoder手机版-导航