Metodos numericos tarea
Enviado por vergasqpongo • 21 de Noviembre de 2015 • Tarea • 527 Palabras (3 Páginas) • 180 Visitas
[pic 1]
[pic 2][pic 3]
Métodos Numéricos
[pic 4]
[pic 5]
[pic 6]
Problema 1
[pic 7]
Código
Option Explicit
Dim i As Integer
Dim x0, x1, eps, ep, fx0, fx1, x2 As Double
Private Sub CommandButton1_Click()
x0 = Cells(14, 6)
x1 = Cells(15, 6)
x2 = 0
eps = Cells(16, 6)
ep = Cells(17, 6)
fx0 = ep - (2 - (1 / (1 + x0 ^ 2))) * ((1 + x0 ^ 2) ^ 0.5) + 2 * x0
fx1 = ep - (2 - (1 / (1 + x1 ^ 2))) * ((1 + x1 ^ 2) ^ 0.5) + 2 * x1
x2 = x1 - ((x0 - x1) / (fx0 - fx1)) * fx1
Do While (Abs(x2 - x1) > eps)
x0 = x1
x1 = x2
fx1 = ep - (2 - (1 / (1 + x0 ^ 2))) * ((1 + x1 ^ 2) ^ 0.5) + 2 * x1
fx0 = ep - (2 - (1 / (1 + x1 ^ 2))) * ((1 + x0 ^ 2) ^ 0.5) + 2 * x0
x2 = x1 - ((x0 - x1) / (fx0 - fx1)) * fx1
Loop
Cells(18, 6) = x2
End Sub
___________________________________________________________________________________
Private Sub CommandButton2_Click()
For i = 18 To 20
Cells(i, 6) = ""
Next
End Sub
Solución
[pic 8]
Problema 2
[pic 9]
Código
Option Explicit
Dim i As Integer
Dim x0, x1, n, l, k, h, E, eps, sh0, ch0, sh1, ch1, lambda0, lambda1, alfa0, alfa1, x2, f0, f1 As Double
___________________________________________________________________________________
Private Sub CommandButton1_Click()
x0 = Cells(2, 14)
x1 = Cells(3, 14)
n = Cells(4, 14)
l = Cells(5, 14)
k = Cells(6, 14)
h = Cells(7, 14)
E = Cells(8, 14)
eps = Cells(9, 14)
Do While (E > eps)
lambda0 = (k * x0 / h) ^ 0.5
alfa0 = (h * x0 / k) ^ 0.5
sh0 = 0.5 * (2.718282 ^ (l / lambda0) - 2.718282 ^ (-(l / lambda0)))
...