Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Integrantes:
Carol De León
Alexander Flores
Edward González
Katherine González
Profesora:
Geovana Bonagas
Grupo:
9II-121
Métodos preparados:
End While
Label6.Text = "Se realizaron" & n & "repeticiones"
TextBox5.Text = rn
TextBox6.Text = Xo
End Sub
Private Function fb(ByVal x As Single) As Single
Dim resultado As Single
resultado = x ^ 4 + 2 * x ^ 2 + 10 * x - 20 'funcion a evaluar
Return resultado
End Function
Sub biseccion(ByVal xi As Single, ByVal xd As Single, ByVal ee As Single, ByVal
nmax As Integer)
Dim n As Integer
Dim xn As Double
Dim res As Single
Dim rn As Single
Dim mul As Single
Dim fin As Boolean
Dim xnold As Single
n = 0
xn = 0
res = 0
rn = 100
mul = fb(xi) * fb(xd)
If (mul > 0) Then
MessageBox.Show("No se puede encontrar raíz por este método")
End
End If
fin = False
While (fin = False)
xnold = xn
n = n + 1
If (xn <> 0 And n > 1) Then
rn = Math.Abs((xn - xnold) / xn)
End If
mul = fb(xn) * fb(xi)
If (mul < 0) Then
xd = xn
ElseIf (mul > 0) Then
xi = xn
Else
rn = 0
End If
mul = fb(xi) * fb(xd)
If ((n > nmax) Or (ee > rn) Or (rn = 0) Or (mul > 0)) Then
fin = True
End If
End While
Label6.Text = "se realizaron" & n & "repeticiones "
TextBox2.Text = xn
TextBox3.Text = rn
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Codigo
Public Class Form1
Function f(x)
f = x ^ 2 * Math.Abs(Math.Cos(Math.Sqrt(x))) - 5
End Function
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
tol = Val(TextBox4.Text)
nmax = Val(TextBox5.Text)
n = 3.1415
Do
c = b - (f(b) * (a - b)) / (f(a) - f(b))
eror = Math.Abs(c - b)
If f(b) * f(c) < 0 Then
a = b
b = c
TextBox7.Text = Math.Abs((c - b) / c)
Else
a = c
b = b
TextBox7.Text = Math.Abs((c - a) / c)
End If
ListBox1.Items.Add(c)
n = n + 1
TextBox6.Text = c
End Sub
n = 0
While fin = True
x1new = (ter1 - valor2 * X2old - valor3 * X3old) / valor1
x2new = (ter2 - valor4 * x1new - valor6 * X3old) / valor5
x3new = (ter3 - valor7 * x1new - valor8 * x2new) / valor9
X1old = x1new
X2old = x2new
X3old = x3new
n = n + 1
If (n > nmaximo) Or (rx1n < eror And rx2n < eror And rx3n < eror) Then
fin = False
End If
End While
TextBox18.Text = rx1n
TextBox19.Text = rx2n
TextBox20.Text = rx3n
End Sub
End Sub
End Class
Ejecución del método