单峰区间确定Function f(x As Single) As Doublef = Val(Text3.Text) * x * x + Val(Text4.Text) * x + Val(Text5.Text)End FunctionPrivate Sub Command1_Click()Dim a!, b!, a0!, h!Dim a1!, a2!, a3!Dim f1!, f2!, f3!a0 = Val(Text1.Text)h = Val(Text2.Text)a1 = a0f1 = f(a1)a2 = a1 + hf2 = f(a2)If f2 = f1 Then h = -h a3 = a1: f3 = f1 a1 = a2: f1 = f2 a2 = a3: f2 = f3 a3 = a2 + h f3 = f(a3)Elsea3 = a2 + hf3 = f(a3)End IfDo h = 2 * h: a1 = a2 f1 = f2: