用黄金分割法程序解题

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Else a = a1 a1 = b1 f1 = f2 b1 = a + 0.618 * (b - a) f2 = b1 * b1 - 10 * b1 + 36 End If End If Loop Until flag = 0 Label1.Caption = ay Label2.Caption = ay * ay - 10 * ay + 36 End Sub
黄金分割法
黄金分割法程序题
min F ( x) = x − 10 x ຫໍສະໝຸດ Baidu 36
2
• • • • • • • • • • • • • • • • • • • • • • • •
Private Sub Command1_Click() Dim a As Double Dim b As Double Dim e As Double Dim x As Double Dim ay As Double Dim f1 As Double Dim f2 As Double Dim flag As Integer flag = 1 Dim a1 As Double Dim b1 As Double a = Text1.Text b = Text2.Text e = Text3.Text a1 = b - 0.618 * (b - a) b1 = a + 0.618 * (b - a) f1 = a1 * a1 - 10 * a1 + 36 f2 = b1 * b1 - 10 * b1 + 36 Do If ((b - a) <= e) Then ay = (a1 + b1) / 2 flag = 0
相关文档
最新文档