Metodo biseccion en codigo c++

Páginas: 3 (621 palabras) Publicado: 8 de marzo de 2012
Metodo de biseccion C++
Option Explicit
Dim sig As String
Dim b As String
Dim a As Double
Dim aux As Double
Dim xi As Double
Dim xs As Double
Dim xr As Double
Dim fxi As Double
Dim fxs AsDouble
Dim fxr As Double
Dim ff As Double
Dim ea As Double
Dim correcto As Integer
Private Sub cmdcalcular_Click()
fxi = (Exp(-xi)) - xi
fxs = (Exp(-xs)) - xs
xr = (xi + xs) / 2
fxr =(Exp(-xr)) - xr
ff = fxi * fxr
Label2.Caption = Label2.Caption & vbCrLf & Format(xi, "0.#####")
Label4.Caption = Label4.Caption & vbCrLf & Format(xs, "0.#####")
If (ff > 0) Then
sig ="+"
xi = xr
ElseIf (ff < 0) Then
sig = "-"
xs = xr
End If
If (correcto > 0) Then
ea = Abs(((xr - a) / xr) * 100)
End If
Label1.Caption = Label1.Caption & vbCrLf & correctoLabel3.Caption = Label3.Caption & vbCrLf & Format(fxi, "0.#####")
Label5.Caption = Label5.Caption & vbCrLf & Format(fxs, "0.#####")
Label6.Caption = Label6.Caption & vbCrLf &Format(xr, "0.#####")
Label7.Caption = Label7.Caption & vbCrLf & Format(fxr, "0.#####")
Label8.Caption = Label8.Caption & vbCrLf & sig
Label9.Caption = Label9.Caption & vbCrLf& Format(ea, "0.####")
a = xr
If (ea < 0.01) And (correcto > 0) Then
frmbiseccion.Visible = False
cmdcalcular.Enabled = False
frmprincipal.Visible = False
MsgBox "Raiz Encontrada en Xr="& xr, vbExclamation,
frmbiseccion.Visible = True
End If
correcto = correcto + 1
End Sub
Private Sub cmdsalir_Click()
Unload Me
frmprincipal.Visible = True
End Sub
Private SubCommand1_Click()
Label1.Caption = " I"
Label2.Caption = " xi"
Label3.Caption = " f(xi)"
Label4.Caption = " xs"
Label5.Caption = " f(xs)"
Label6.Caption = " xr"
Label7.Caption = " f(xr)"
Label8.Caption = "f(xi) f(xr)"
Label9.Caption = " Ea %"
correcto = 0
cmdcalcular.Enabled = True
xi = 0
xs = 1
End Sub
Private Sub Form_Load()
xi = 0
xs = 1
ea = 0
correcto = 0
frmprincipal.Visible =...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Biseccion en c
  • Metodo de biseccion
  • Metodo Biseccion
  • Metodo De Biseccion
  • Metodo De Biseccion
  • (Metodo De Biseccion)
  • Metodo de la biseccion
  • Metodo de biseccion

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS