'X1a A1 - X1 'Stat 1 'X1 X1a: Dim As Double Dim As Double
'X1a A1 - X1 'Stat 1 'X1 X1a: Dim As Double Dim As Double
'X1a A1 - X1 'Stat 1 'X1 X1a: Dim As Double Dim As Double
Math
Public Class Bisection
Dim randomclass As New Random()
Private Sub Reset_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs)
Handles Reset.Click
ListBox_a.Items.Clear()
ListBox_b.Items.Clear()
ListBoxE.Items.Clear()
ListBox_X1.Items.Clear()
ListBox_X2.Items.Clear()
listboxiterasi.Items.Clear()
End Sub
Private Sub Enter_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs)
Handles Enter.Click
Dim A As Double
Dim B As Double
Dim C As Double
Dim A1 As Double
Dim B1 As Double
Dim Eror As Double
Dim X1 As Double
Dim X2 As Double
Dim fx1 As Double
Dim fx2 As Double
Dim stat, stat1 As Integer
Dim er As Double
Dim iterasi As Integer
Dim x1a, x2a As Double
Dim xakhir As Double
A = TextA.Text
B = TextB.Text
C = TextC.Text
A1 = TextA1.Text
B1 = TextB1.Text
X1 = TextX1.Text
X2 = TextX2.Text
Eror = TextE.Text
'Dim l1 As New Random()
'Dim l2 As New Random()
If er < 0 Then
er = er * -1
End If
ListBox_a.Items.Add(A1)
ListBox_b.Items.Add(B1)
ListBoxE.Items.Add(er)
ListBox_X1.Items.Add(X1)
ListBox_X2.Items.Add(X2)
listboxiterasi.Items.Add(iterasi)
If fx1 >= fx2 Then
A1 = X1
'x1a = A1 - X1
'stat = 1
'X1 = x1a
Label9.Text = "A"
X1 = randomclass.Next(A1, B1)
End If
If fx2 > fx1 Then
B1 = X2
'x2a = B1 - X2
X2 = randomclass.Next(A1, B1)
'stat = 0
'X2 = x2a
End If
If er > Eror Then
stat1 = 1
'Exit Do
End If
If er <= Eror Then
stat1 = 0
Exit Do
End If
iterasi = iterasi + 1
Loop
'End While
xakhir = A1 + B1
xakhir = xakhir / 2
' Dim c As Integer
'c = Math.Rou
Text_Xoptimal.Text = xakhir
End Sub
stat1 = 1
iterasi = 0
Do
'If iterasi > 3 Then
' Exit Do
'End If
fx1 = pers1(A, B, c, X1)
fx2 = pers1(A, B, c, X2)
er = B1 - A1
h3 = h1 + h2
h4 = h3 + n3
pers1 = h4
End Function
Private Sub Bisection_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
End Class