这道vb题怎么做
1个回答
展开全部
第6题:
Private Sub Command1_Click()
dx = (5 - 2) / 100000
For x = 2 To 5 Step dx
s = s + ((x + 1) / Log(x) + (x + dx + 1) / Log(x + dx)) / 2 * dx
Next x
Print " Sum(2 to 5)[(x+1)/lnx]dx ="; s
End Sub
第7题:
Private Sub Command1_Click()
Dim LB As Single, UB As Single
LB = -2: UB = -1
Do
x = (LB + UB) / 2
y = 3 * x ^ 3 - 4 * x ^ 2 - 5 * x + 13
If Abs(y) < 0.00001 And UB - LB < 0.0001 Then
Print "x="; x
Exit Do
Else
If y > 0 Then
UB = UB - 0.0001
Else
LB = LB + 0.0001
End If
End If
Loop
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询