Professional Documents
Culture Documents
Dim i, n As Integer
Randomize()
nlimp = 0
i=0
TextBox4.Text = TextBox4.Text & "X [" & i & "] = " & x & Chr(13) &
Chr(10)
For i = 1 To k
y=x*x
z = Int(y / 100)
v = Int(z / 10 ^ (2 * n))
t = v * (10 ^ (2 * n))
w=z-t
TextBox5.Text = TextBox5.Text & "Y [" & i & "] = " & y & Chr(13) &
Chr(10)
TextBox6.Text = TextBox6.Text & "W [" & i & "] = " & w & Chr(13) &
Chr(10)
End If
If i = nlimp * 10 + 10 Then
nlimp = nlimp + 1
TextBox6.Text = TextBox6.Text & "W [" & i & "] = " & w & Chr(13) &
Chr(10)
End If
x=w
TextBox4.Text = TextBox4.Text & "X [" & i & "] = " & x & Chr(13) &
Chr(10)
Next
BOTON NUEVO
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
BOTON SALIR
BOTON EJECUTAR
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim I, S, R, A, B, M As Integer
Dim X1 As Double
X1 = (A ^ I * S + B * (A ^ I - 1) / (A - 1)) Mod M
TextBox6.Text = TextBox6.Text & "NA[" & I & "] = " & X1 & Chr(13)
& Chr(10)
BOTON NUEVO
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox1.Focus()
End Sub
BOTON SALIR
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button3.Click
METODO MONTECARLO
BOTON SIMULAR
Next REM pone sumas a un vector sp(1) = sph : sp(2) = sptp : sp(3) =
spv : sp(4) = splp For i = 0 To np - 1 tabla.Rows.Add(np) Next For i = 0
To np - 1 tabla.Rows(i).Cells(0).Value = i + 1
tabla.Rows(i).Cells(1).Value = Format(ph(i), "#####.00")
tabla.Rows(i).Cells(2).Value = Format(ptp(i), "#####.00")
tabla.Rows(i).Cells(3).Value = Format(pv(i), "#####.00")
tabla.Rows(i).Cells(4).Value = Format(pld(i), "#####.00") Next
BOTON NUEVO
BOTON SALIR