Private Sub cmdCalcular_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdCalcular.Click Dim Xmayor As Double, Xmenor As Double Dim Xc As Double, fmenor As Double, fmayor As Double Dim cont As Byte, z As Double Xmayor = Val(txtXmenor.Text) Xmenor = Val(txtXmayor.Text) fmayor = f(Xmayor) If fmayor < 0 Then MsgBox("Debe ingresar otro valor en Xmayor mayor o menor que Xmenor" + Chr(13) + "para que Ia funcion resulte positiva") txtXmenor.Focus() Exit Sub End If fmenor = f(Xmenor) If fmenor > 0 Then MsgBox("Debe ingresar otro valor en Xmenor mayor o menor que Xmayor" + Chr(13) + "para que Ia fund& resulte negativa") txtXmayor.Focus() Exit Sub End If cont = 0 Do cont = cont + 1 Xc = (Xmayor + Xmenor) / 2 z = f(Xc) If z > 0 Then Xmayor = Xc Else Xmenor = Xc End If lstIteraciones.Items.Add(Format(cont, "000") & Space(10) & Format(z, "0.0000000000") & Space(10) & Format(Xmenor, "0.0000000000"))
Loop Until System.Math.Abs(z) < Val(txtEPS.Text)
txtXcalculado.Text = Format(Xmenor, "0.0000000000") End Sub
Private Sub cmdSalirClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdSalir.Click End End Sub End Class
Module Ecuación_No_Lineal_Bisección Public Function f(ByVal X As Double) As Double